Skip to content

Commit

Permalink
Revert "Simplify sqlite to use predefined connection "testing". (#22855
Browse files Browse the repository at this point in the history
…)" (#22857)

This reverts commit 2ae6350.
  • Loading branch information
taylorotwell authored Jan 19, 2018
1 parent 2ae6350 commit 0de40a6
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 9 deletions.
9 changes: 4 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@
</whitelist>
</filter>
<php>
<env name="DB_CONNECTION" value="testing" />
<!--
<env name="REDIS_HOST" value="127.0.0.1" />
<env name="REDIS_PORT" value="6379" />
-->
<!--
<env name="REDIS_HOST" value="127.0.0.1" />
<env name="REDIS_PORT" value="6379" />
-->
</php>
</phpunit>
7 changes: 7 additions & 0 deletions tests/Integration/Auth/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ 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']);
}

Expand Down
8 changes: 8 additions & 0 deletions tests/Integration/Database/DatabaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@ 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' => '',
]);
}
}
8 changes: 8 additions & 0 deletions tests/Integration/Database/EloquentDeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ 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()
Expand Down
6 changes: 6 additions & 0 deletions tests/Integration/Database/EloquentFactoryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ 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:',
Expand Down
8 changes: 8 additions & 0 deletions tests/Integration/Database/EloquentUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ 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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ 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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ 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);

Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Queue/JobChainingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ protected function getEnvironmentSetUp($app)
{
$app['config']->set('app.debug', 'true');

$app['config']->set('database.default', 'testbench');

$app['config']->set('queue.connections.sync1', [
'driver' => 'sync',
]);
Expand Down
16 changes: 12 additions & 4 deletions tests/Integration/Queue/ModelSerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ 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:',
Expand Down Expand Up @@ -68,16 +76,16 @@ public function it_serialize_user_on_default_connection()

$unSerialized = unserialize($serialized);

$this->assertEquals('testing', $unSerialized->user->getConnectionName());
$this->assertEquals('testbench', $unSerialized->user->getConnectionName());
$this->assertEquals('mohamed@laravel.com', $unSerialized->user->email);

$serialized = serialize(new ModelSerializationTestClass(ModelSerializationTestUser::on('testing')->get()));
$serialized = serialize(new ModelSerializationTestClass(ModelSerializationTestUser::on('testbench')->get()));

$unSerialized = unserialize($serialized);

$this->assertEquals('testing', $unSerialized->user[0]->getConnectionName());
$this->assertEquals('testbench', $unSerialized->user[0]->getConnectionName());
$this->assertEquals('mohamed@laravel.com', $unSerialized->user[0]->email);
$this->assertEquals('testing', $unSerialized->user[1]->getConnectionName());
$this->assertEquals('testbench', $unSerialized->user[1]->getConnectionName());
$this->assertEquals('taylor@laravel.com', $unSerialized->user[1]->email);
}

Expand Down

0 comments on commit 0de40a6

Please sign in to comment.