From 2ae63504684f259dffe7835370f68a546459a7df Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Fri, 19 Jan 2018 21:43:27 +0800 Subject: [PATCH] Simplify sqlite to use predefined connection "testing". (#22855) Signed-off-by: Mior Muhammad Zaki --- phpunit.xml.dist | 9 +++++---- tests/Integration/Auth/AuthenticationTest.php | 7 ------- tests/Integration/Database/DatabaseTestCase.php | 8 -------- .../Integration/Database/EloquentDeleteTest.php | 8 -------- .../Database/EloquentFactoryBuilderTest.php | 6 ------ .../Integration/Database/EloquentUpdateTest.php | 8 -------- .../Concerns/InteractsWithAuthenticationTest.php | 7 ------- .../SendingMailNotificationsTest.php | 8 -------- tests/Integration/Queue/JobChainingTest.php | 2 -- .../Integration/Queue/ModelSerializationTest.php | 16 ++++------------ 10 files changed, 9 insertions(+), 70 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d963e75d85d9..63af998f2c2e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -27,9 +27,10 @@ - + + diff --git a/tests/Integration/Auth/AuthenticationTest.php b/tests/Integration/Auth/AuthenticationTest.php index 475a8c5bb84e..7dcb28f7dc11 100644 --- a/tests/Integration/Auth/AuthenticationTest.php +++ b/tests/Integration/Auth/AuthenticationTest.php @@ -18,13 +18,6 @@ protected function getEnvironmentSetUp($app) $app['config']->set('app.debug', 'true'); $app['config']->set('auth.providers.users.model', AuthenticationTestUser::class); - $app['config']->set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); - $app['config']->set('hashing', ['driver' => 'bcrypt']); } diff --git a/tests/Integration/Database/DatabaseTestCase.php b/tests/Integration/Database/DatabaseTestCase.php index af8c9ff1ea7e..26fcfade5f0e 100644 --- a/tests/Integration/Database/DatabaseTestCase.php +++ b/tests/Integration/Database/DatabaseTestCase.php @@ -9,13 +9,5 @@ class DatabaseTestCase extends TestCase protected function getEnvironmentSetUp($app) { $app['config']->set('app.debug', 'true'); - - $app['config']->set('database.default', 'testbench'); - - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); } } diff --git a/tests/Integration/Database/EloquentDeleteTest.php b/tests/Integration/Database/EloquentDeleteTest.php index 1c21e082c582..d164aab09d64 100644 --- a/tests/Integration/Database/EloquentDeleteTest.php +++ b/tests/Integration/Database/EloquentDeleteTest.php @@ -14,14 +14,6 @@ class EloquentDeleteTest extends TestCase protected function getEnvironmentSetUp($app) { $app['config']->set('app.debug', 'true'); - - $app['config']->set('database.default', 'testbench'); - - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); } public function setUp() diff --git a/tests/Integration/Database/EloquentFactoryBuilderTest.php b/tests/Integration/Database/EloquentFactoryBuilderTest.php index 3553b02d9436..2035add83c4a 100644 --- a/tests/Integration/Database/EloquentFactoryBuilderTest.php +++ b/tests/Integration/Database/EloquentFactoryBuilderTest.php @@ -17,12 +17,6 @@ protected function getEnvironmentSetUp($app) { $app['config']->set('app.debug', 'true'); - $app['config']->set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); $app['config']->set('database.connections.alternative-connection', [ 'driver' => 'sqlite', 'database' => ':memory:', diff --git a/tests/Integration/Database/EloquentUpdateTest.php b/tests/Integration/Database/EloquentUpdateTest.php index dcb0c56c7c60..dc7d95a31a2e 100644 --- a/tests/Integration/Database/EloquentUpdateTest.php +++ b/tests/Integration/Database/EloquentUpdateTest.php @@ -15,14 +15,6 @@ class EloquentUpdateTest extends TestCase protected function getEnvironmentSetUp($app) { $app['config']->set('app.debug', 'true'); - - $app['config']->set('database.default', 'testbench'); - - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); } public function setUp() diff --git a/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php index 9bcb15897a4b..9e78594bdf54 100644 --- a/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php +++ b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php @@ -14,13 +14,6 @@ class InteractsWithAuthenticationTest extends TestCase protected function getEnvironmentSetUp($app) { $app['config']->set('auth.providers.users.model', AuthenticationTestUser::class); - - $app['config']->set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); } public function setUp() diff --git a/tests/Integration/Notifications/SendingMailNotificationsTest.php b/tests/Integration/Notifications/SendingMailNotificationsTest.php index 5f1285401457..1edfaf1a3108 100644 --- a/tests/Integration/Notifications/SendingMailNotificationsTest.php +++ b/tests/Integration/Notifications/SendingMailNotificationsTest.php @@ -32,14 +32,6 @@ protected function getEnvironmentSetUp($app) { $app['config']->set('app.debug', 'true'); - $app['config']->set('database.default', 'testbench'); - - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); - $this->mailer = Mockery::mock(Mailer::class); $this->markdown = Mockery::mock(Markdown::class); diff --git a/tests/Integration/Queue/JobChainingTest.php b/tests/Integration/Queue/JobChainingTest.php index 4d2c369e061d..d30f4ceb6ee1 100644 --- a/tests/Integration/Queue/JobChainingTest.php +++ b/tests/Integration/Queue/JobChainingTest.php @@ -18,8 +18,6 @@ protected function getEnvironmentSetUp($app) { $app['config']->set('app.debug', 'true'); - $app['config']->set('database.default', 'testbench'); - $app['config']->set('queue.connections.sync1', [ 'driver' => 'sync', ]); diff --git a/tests/Integration/Queue/ModelSerializationTest.php b/tests/Integration/Queue/ModelSerializationTest.php index 4d6adfe1d03d..c2f087e29c20 100644 --- a/tests/Integration/Queue/ModelSerializationTest.php +++ b/tests/Integration/Queue/ModelSerializationTest.php @@ -15,14 +15,6 @@ protected function getEnvironmentSetUp($app) { $app['config']->set('app.debug', 'true'); - $app['config']->set('database.default', 'testbench'); - - $app['config']->set('database.connections.testbench', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - ]); - $app['config']->set('database.connections.custom', [ 'driver' => 'sqlite', 'database' => ':memory:', @@ -76,16 +68,16 @@ public function it_serialize_user_on_default_connection() $unSerialized = unserialize($serialized); - $this->assertEquals('testbench', $unSerialized->user->getConnectionName()); + $this->assertEquals('testing', $unSerialized->user->getConnectionName()); $this->assertEquals('mohamed@laravel.com', $unSerialized->user->email); - $serialized = serialize(new ModelSerializationTestClass(ModelSerializationTestUser::on('testbench')->get())); + $serialized = serialize(new ModelSerializationTestClass(ModelSerializationTestUser::on('testing')->get())); $unSerialized = unserialize($serialized); - $this->assertEquals('testbench', $unSerialized->user[0]->getConnectionName()); + $this->assertEquals('testing', $unSerialized->user[0]->getConnectionName()); $this->assertEquals('mohamed@laravel.com', $unSerialized->user[0]->email); - $this->assertEquals('testbench', $unSerialized->user[1]->getConnectionName()); + $this->assertEquals('testing', $unSerialized->user[1]->getConnectionName()); $this->assertEquals('taylor@laravel.com', $unSerialized->user[1]->email); }