refactors to use a Plugin to parse --ci option

This commit is contained in:
Fabio Ivona
2021-09-22 14:53:16 +02:00
parent 05c1c82ae2
commit 601c4b01fc
8 changed files with 100 additions and 28 deletions

View 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);
});