Skip to content

Commit 4a2c866

Browse files
committed
fix tests for ochestra/testbench ^8.3
1 parent 4a1a7c9 commit 4a2c866

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@
2020
<directory suffix=".php">./src</directory>
2121
</include>
2222
</source>
23+
<php>
24+
<server name="DB_CONNECTION" value="testing"/>
25+
</php>
2326
</phpunit>

tests/TestCase.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Limenet\LaravelElasticaBridge\Tests;
66

77
use Illuminate\Database\Eloquent\Factories\Factory;
8+
use Illuminate\Foundation\Testing\RefreshDatabase;
89
use Limenet\LaravelElasticaBridge\LaravelElasticaBridgeServiceProvider;
910
use Limenet\LaravelElasticaBridge\Tests\App\Elasticsearch\CustomerIndex;
1011
use Limenet\LaravelElasticaBridge\Tests\App\Elasticsearch\InvoiceIndex;
@@ -15,6 +16,8 @@
1516

1617
class TestCase extends Orchestra
1718
{
19+
use RefreshDatabase;
20+
1821
protected function setUp(): void
1922
{
2023
parent::setUp();
@@ -48,14 +51,10 @@ protected function getPackageProviders($app)
4851
];
4952
}
5053

51-
public function getEnvironmentSetUp($app): void
54+
protected function defineEnvironment($app): void
5255
{
53-
config()->set('database.default', 'testing');
54-
55-
config()->set('elastica-bridge.elasticseach.host', env('ELASTICSEARCH_HOST', 'localhost'));
56-
config()->set('elastica-bridge.elasticseach.port', 9200);
57-
5856
$migration = include __DIR__.'/database/migrations/SetupTables.php';
57+
5958
$migration->up();
6059
}
6160
}

tests/Unit/ClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function test_configured_client(): void
2121
{
2222
$client = $this->elasticaClient->getClient();
2323

24-
$this->assertSame(config('elastica-bridge.elasticseach.host'), $client->getConfig('host'));
25-
$this->assertEquals(config('elastica-bridge.elasticseach.port'), $client->getConfig('port'));
24+
$this->assertSame('localhost', $client->getConfig('host'));
25+
$this->assertEquals(9200, $client->getConfig('port'));
2626
}
2727
}

0 commit comments

Comments
 (0)