-
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from paupenin/extendable-laravel-test-command
Extendable Environment Variables in Laravel Test Command with Tests
- Loading branch information
Showing
5 changed files
with
230 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
tests/LaravelApp/tests/Feature/EnvironmentCustomVariablesTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Feature; | ||
|
||
use Tests\TestCase; | ||
|
||
/** | ||
* @group environmentCustomVariables | ||
*/ | ||
class EnvironmentCustomVariablesTest extends TestCase | ||
{ | ||
/** | ||
* @group environmentNoCVPhpunit | ||
*/ | ||
public function testEnvironmentNoCustomVariablesPhpunit() | ||
{ | ||
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING')); | ||
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PHPUNIT')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PARALLEL')); | ||
} | ||
|
||
/** | ||
* @group environmentNoCVParallel | ||
*/ | ||
public function testEnvironmentNoCustomVariablesParallel() | ||
{ | ||
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING')); | ||
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PHPUNIT')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PARALLEL')); | ||
} | ||
|
||
/** | ||
* @group environmentNoCVParallelRecreate | ||
*/ | ||
public function testEnvironmentNoCustomVariablesParallelWithRecreate() | ||
{ | ||
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING')); | ||
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PHPUNIT')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PARALLEL')); | ||
} | ||
|
||
/** | ||
* @group environmentCVPhpunit | ||
*/ | ||
public function testEnvironmentCustomVariablesPhpunit() | ||
{ | ||
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING')); | ||
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES')); | ||
$this->assertEquals(1, env('CUSTOM_ENV_VARIABLE')); | ||
$this->assertEquals(1, env('CUSTOM_ENV_VARIABLE_FOR_PHPUNIT')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PARALLEL')); | ||
} | ||
|
||
/** | ||
* @group environmentCVParallel | ||
*/ | ||
public function testEnvironmentCustomVariablesParallel() | ||
{ | ||
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING')); | ||
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES')); | ||
$this->assertEquals(1, env('CUSTOM_ENV_VARIABLE')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PHPUNIT')); | ||
$this->assertEquals(1, env('CUSTOM_ENV_VARIABLE_FOR_PARALLEL')); | ||
} | ||
|
||
/** | ||
* @group environmentCVParallelRecreate | ||
*/ | ||
public function testEnvironmentCustomVariablesParallelWithRecreate() | ||
{ | ||
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING')); | ||
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES')); | ||
$this->assertEquals(1, env('CUSTOM_ENV_VARIABLE')); | ||
$this->assertEquals(null, env('CUSTOM_ENV_VARIABLE_FOR_PHPUNIT')); | ||
$this->assertEquals(1, env('CUSTOM_ENV_VARIABLE_FOR_PARALLEL')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters