Skip to content

Commit c666f89

Browse files
authored
[11.x] Test improvements (#54879)
* [11.x] Test Improvements Signed-off-by: Mior Muhammad Zaki <[email protected]> * Test Improvements Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 1154a31 commit c666f89

15 files changed

+21
-24
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"league/flysystem-read-only": "^3.25.1",
112112
"league/flysystem-sftp-v3": "^3.25.1",
113113
"mockery/mockery": "^1.6.10",
114-
"orchestra/testbench-core": "^9.9.4",
114+
"orchestra/testbench-core": "^9.11.2",
115115
"pda/pheanstalk": "^5.0.6",
116116
"php-http/discovery": "^1.15",
117117
"phpstan/phpstan": "^2.0",

tests/Integration/Cache/DynamoDbStoreTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testLocksCanBeAcquired()
6565
* @param \Illuminate\Foundation\Application $app
6666
* @return void
6767
*/
68-
protected function getEnvironmentSetUp($app)
68+
protected function defineEnvironment($app)
6969
{
7070
if (! env('DYNAMODB_CACHE_TABLE')) {
7171
$this->markTestSkipped('DynamoDB not configured.');

tests/Integration/Cookie/CookieTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function test_cookie_is_sent_back_with_proper_expire_time_with_respect_to
4242
$this->assertEquals(Carbon::now()->getTimestamp() + 60, $response->headers->getCookies()[1]->getExpiresTime());
4343
}
4444

45-
protected function getEnvironmentSetUp($app)
45+
protected function defineEnvironment($app)
4646
{
4747
$app->instance(
4848
ExceptionHandler::class,

tests/Integration/Database/EloquentTransactionWithAfterCommitUsingDatabaseTransactionsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp(): void
3232
}
3333
}
3434

35-
protected function getEnvironmentSetUp($app)
35+
protected function defineEnvironment($app)
3636
{
3737
$connection = $app->make('config')->get('database.default');
3838

tests/Integration/Database/MariaDb/DatabaseEmulatePreparesMariaDbConnectionTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#[RequiresPhpExtension('pdo_mysql')]
1111
class DatabaseEmulatePreparesMariaDbConnectionTest extends DatabaseMariaDbConnectionTest
1212
{
13-
protected function getEnvironmentSetUp($app)
13+
protected function defineEnvironment($app)
1414
{
15-
parent::getEnvironmentSetUp($app);
15+
parent::defineEnvironment($app);
1616

1717
$app['config']->set('database.connections.mariadb.options', [
1818
PDO::ATTR_EMULATE_PREPARES => true,

tests/Integration/Database/MySql/DatabaseEmulatePreparesMySqlConnectionTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#[RequiresPhpExtension('pdo_mysql')]
1111
class DatabaseEmulatePreparesMySqlConnectionTest extends DatabaseMySqlConnectionTest
1212
{
13-
protected function getEnvironmentSetUp($app)
13+
protected function defineEnvironment($app)
1414
{
15-
parent::getEnvironmentSetUp($app);
15+
parent::defineEnvironment($app);
1616

1717
$app['config']->set('database.connections.mysql.options', [
1818
PDO::ATTR_EMULATE_PREPARES => true,

tests/Integration/Database/Postgres/PostgresSchemaBuilderTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#[RequiresPhpExtension('pdo_pgsql')]
1414
class PostgresSchemaBuilderTest extends PostgresTestCase
1515
{
16-
protected function getEnvironmentSetUp($app)
16+
protected function defineEnvironment($app)
1717
{
18-
parent::getEnvironmentSetUp($app);
18+
parent::defineEnvironment($app);
1919

2020
$app['config']->set('database.connections.pgsql.search_path', 'public,private');
2121
}

tests/Integration/Mail/SendingMarkdownMailTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class SendingMarkdownMailTest extends TestCase
1414
{
15-
protected function getEnvironmentSetUp($app)
15+
protected function defineEnvironment($app)
1616
{
1717
$app['config']->set('mail.driver', 'array');
1818

tests/Integration/Mail/SendingQueuedMailTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class SendingQueuedMailTest extends TestCase
1313
{
14-
protected function getEnvironmentSetUp($app)
14+
protected function defineEnvironment($app)
1515
{
1616
$app['config']->set('mail.driver', 'array');
1717

tests/Integration/Queue/JobEncryptionTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class JobEncryptionTest extends DatabaseTestCase
2121
{
2222
use DatabaseMigrations;
2323

24-
protected function getEnvironmentSetUp($app)
24+
protected function defineEnvironment($app)
2525
{
26-
parent::getEnvironmentSetUp($app);
26+
parent::defineEnvironment($app);
2727

2828
$app['config']->set('app.key', Str::random(32));
2929
$app['config']->set('queue.default', 'database');

tests/Integration/Queue/ModelSerializationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ModelSerializationTest extends TestCase
1818
{
1919
use RefreshDatabase;
2020

21-
protected function getEnvironmentSetUp($app)
21+
protected function defineEnvironment($app)
2222
{
2323
$app['config']->set('database.connections.custom', [
2424
'driver' => 'sqlite',

tests/Integration/Queue/QueueConnectionTest.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88
use Illuminate\Foundation\Bus\Dispatchable;
99
use Illuminate\Support\Facades\Bus;
1010
use Mockery as m;
11+
use Orchestra\Testbench\Attributes\WithConfig;
1112
use Orchestra\Testbench\TestCase;
1213
use Throwable;
1314

15+
#[WithConfig('queue.default', 'sqs')]
16+
#[WithConfig('queue.connections.sqs.after_commit', true)]
1417
class QueueConnectionTest extends TestCase
1518
{
16-
protected function getEnvironmentSetUp($app)
17-
{
18-
$app['config']->set('queue.default', 'sqs');
19-
$app['config']->set('queue.connections.sqs.after_commit', true);
20-
}
21-
2219
protected function tearDown(): void
2320
{
2421
QueueConnectionTestJob::$ran = false;

tests/Integration/View/BladeAnonymousComponentTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function test_anonymous_components_with_custom_paths_cant_be_rendered_as_
4141
$view = View::make('panel')->render();
4242
}
4343

44-
protected function getEnvironmentSetUp($app)
44+
protected function defineEnvironment($app)
4545
{
4646
$app['config']->set('view.paths', [__DIR__.'/anonymous-components-templates']);
4747
}

tests/Integration/View/BladeTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testViewCacheCommandHandlesConfiguredBladeExtensions()
210210
$this->artisan('view:clear');
211211
}
212212

213-
protected function getEnvironmentSetUp($app)
213+
protected function defineEnvironment($app)
214214
{
215215
$app['config']->set('view.paths', [__DIR__.'/templates']);
216216
}

tests/Integration/View/RenderableViewExceptionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testRenderMethodOfExceptionThrownInViewGetsHandled()
2121
$response->assertSee('This is a renderable exception.');
2222
}
2323

24-
protected function getEnvironmentSetUp($app)
24+
protected function defineEnvironment($app)
2525
{
2626
$app['config']->set('view.paths', [__DIR__.'/templates']);
2727
}

0 commit comments

Comments
 (0)