mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
refactors to use a Plugin to parse --ci option
This commit is contained in:
23
tests/Unit/Plugins/Context.php
Normal file
23
tests/Unit/Plugins/Context.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Pest\Plugins\Context;
|
||||
|
||||
test('environment is set to CI when --ci option is used', function () {
|
||||
$old_env = Context::getInstance()->env;
|
||||
|
||||
$plugin = new Context();
|
||||
|
||||
$plugin->handleArguments(['foo', '--ci', 'bar']);
|
||||
|
||||
expect(Context::getInstance()->env)->toBe(Context::ENV_CI);
|
||||
|
||||
Context::getInstance()->env = $old_env;
|
||||
});
|
||||
|
||||
test('environment is set to Local when --ci option is not used', function () {
|
||||
$plugin = new Context();
|
||||
|
||||
$plugin->handleArguments(['foo', 'bar', 'baz']);
|
||||
|
||||
expect(Context::getInstance()->env)->toBe(Context::ENV_LOCAL);
|
||||
});
|
||||
Reference in New Issue
Block a user