Skip to content

Commit

Permalink
[10.x] Test Improvements (#46659)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
crynobone committed Apr 2, 2023
1 parent 8fcd8c2 commit cc3ccc3
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"league/flysystem-read-only": "^3.3",
"league/flysystem-sftp-v3": "^3.0",
"mockery/mockery": "^1.5.1",
"orchestra/testbench-core": "^8.1",
"orchestra/testbench-core": "^8.3",
"pda/pheanstalk": "^4.0",
"phpstan/phpdoc-parser": "^1.15",
"phpstan/phpstan": "^1.4.7",
Expand Down
3 changes: 1 addition & 2 deletions tests/Integration/Console/CommandEventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Contracts\Console\Kernel as ConsoleKernel;
use Illuminate\Events\Dispatcher;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Env;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Str;
use Orchestra\Testbench\Foundation\Application as Testbench;
Expand Down Expand Up @@ -148,7 +147,7 @@ public function testCommandEventsReceiveParsedInputFromBackground()
'CommandFinished', 'taylor', 'otwell', 'coding',
);

Env::getRepository()->clear('APP_DEBUG');
$laravel->terminate();
}

protected function assertLogged(...$messages)
Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/Console/EnvironmentDecryptCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function testItGeneratesTheEnvironmentFileWithUserProvidedKey()

public function testItGeneratesTheEnvironmentFileWithKeyFromEnvironment()
{
putenv('LARAVEL_ENV_ENCRYPTION_KEY=ponmlkjihgfedcbaponmlkjihgfedcba');
$_SERVER['LARAVEL_ENV_ENCRYPTION_KEY'] = 'ponmlkjihgfedcbaponmlkjihgfedcba';

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

$this->filesystem->shouldHaveReceived('put')
->with(base_path('.env'), 'APP_NAME="Laravel Three"');

unset($_SERVER['LARAVEL_ENV_ENCRYPTION_KEY']);
}

public function testItGeneratesTheEnvironmentFileWhenForcing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

class ImplicitBackedEnumRouteBindingTest extends TestCase
{
protected function defineEnvironment($app): void
{
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
}

public function testWithRouteCachingEnabled()
{
$this->defineCacheRoutes(<<<PHP
Expand Down
5 changes: 5 additions & 0 deletions tests/Integration/Routing/ImplicitModelRouteBindingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ protected function tearDown(): void
parent::tearDown();
}

protected function defineEnvironment($app): void
{
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
}

protected function defineDatabaseMigrations(): void
{
Schema::create('users', function (Blueprint $table) {
Expand Down
5 changes: 5 additions & 0 deletions tests/Integration/Routing/UrlSigningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ protected function tearDown(): void
Carbon::setTestNow(null);
}

protected function defineEnvironment($app): void
{
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
}

public function testSigningUrl()
{
Route::get('/foo/{id}', function (Request $request, $id) {
Expand Down
5 changes: 5 additions & 0 deletions tests/Testing/AssertRedirectToSignedRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ protected function setUp(): void
$this->urlGenerator = $this->app->make(UrlGenerator::class);
}

protected function defineEnvironment($app): void
{
$app['config']->set(['app.key' => 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF']);
}

public function testAssertRedirectToSignedRouteWithoutRouteName()
{
$this->router->get('test-route', function () {
Expand Down

0 comments on commit cc3ccc3

Please sign in to comment.