Skip to content

Commit cc3ccc3

Browse files
authored
[10.x] Test Improvements (#46659)
* Test Improvements Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * Update composer.json --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
1 parent 8fcd8c2 commit cc3ccc3

File tree

7 files changed

+25
-4
lines changed

7 files changed

+25
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"league/flysystem-read-only": "^3.3",
104104
"league/flysystem-sftp-v3": "^3.0",
105105
"mockery/mockery": "^1.5.1",
106-
"orchestra/testbench-core": "^8.1",
106+
"orchestra/testbench-core": "^8.3",
107107
"pda/pheanstalk": "^4.0",
108108
"phpstan/phpdoc-parser": "^1.15",
109109
"phpstan/phpstan": "^1.4.7",

tests/Integration/Console/CommandEventsTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Illuminate\Contracts\Console\Kernel as ConsoleKernel;
88
use Illuminate\Events\Dispatcher;
99
use Illuminate\Filesystem\Filesystem;
10-
use Illuminate\Support\Env;
1110
use Illuminate\Support\Facades\Event;
1211
use Illuminate\Support\Str;
1312
use Orchestra\Testbench\Foundation\Application as Testbench;
@@ -148,7 +147,7 @@ public function testCommandEventsReceiveParsedInputFromBackground()
148147
'CommandFinished', 'taylor', 'otwell', 'coding',
149148
);
150149

151-
Env::getRepository()->clear('APP_DEBUG');
150+
$laravel->terminate();
152151
}
153152

154153
protected function assertLogged(...$messages)

tests/Integration/Console/EnvironmentDecryptCommandTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function testItGeneratesTheEnvironmentFileWithUserProvidedKey()
116116

117117
public function testItGeneratesTheEnvironmentFileWithKeyFromEnvironment()
118118
{
119-
putenv('LARAVEL_ENV_ENCRYPTION_KEY=ponmlkjihgfedcbaponmlkjihgfedcba');
119+
$_SERVER['LARAVEL_ENV_ENCRYPTION_KEY'] = 'ponmlkjihgfedcbaponmlkjihgfedcba';
120120

121121
$this->filesystem->shouldReceive('exists')
122122
->once()
@@ -137,6 +137,8 @@ public function testItGeneratesTheEnvironmentFileWithKeyFromEnvironment()
137137

138138
$this->filesystem->shouldHaveReceived('put')
139139
->with(base_path('.env'), 'APP_NAME="Laravel Three"');
140+
141+
unset($_SERVER['LARAVEL_ENV_ENCRYPTION_KEY']);
140142
}
141143

142144
public function testItGeneratesTheEnvironmentFileWhenForcing()

tests/Integration/Routing/ImplicitBackedEnumRouteBindingTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
class ImplicitBackedEnumRouteBindingTest extends TestCase
1111
{
12+
protected function defineEnvironment($app): void
13+
{
14+
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
15+
}
16+
1217
public function testWithRouteCachingEnabled()
1318
{
1419
$this->defineCacheRoutes(<<<PHP

tests/Integration/Routing/ImplicitModelRouteBindingTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ protected function tearDown(): void
2727
parent::tearDown();
2828
}
2929

30+
protected function defineEnvironment($app): void
31+
{
32+
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
33+
}
34+
3035
protected function defineDatabaseMigrations(): void
3136
{
3237
Schema::create('users', function (Blueprint $table) {

tests/Integration/Routing/UrlSigningTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ protected function tearDown(): void
2121
Carbon::setTestNow(null);
2222
}
2323

24+
protected function defineEnvironment($app): void
25+
{
26+
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
27+
}
28+
2429
public function testSigningUrl()
2530
{
2631
Route::get('/foo/{id}', function (Request $request, $id) {

tests/Testing/AssertRedirectToSignedRouteTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ protected function setUp(): void
3737
$this->urlGenerator = $this->app->make(UrlGenerator::class);
3838
}
3939

40+
protected function defineEnvironment($app): void
41+
{
42+
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
43+
}
44+
4045
public function testAssertRedirectToSignedRouteWithoutRouteName()
4146
{
4247
$this->router->get('test-route', function () {

0 commit comments

Comments
 (0)