fix: checking existing argument with equal sign

This commit is contained in:
Marek Mencl
2024-01-02 14:26:45 +01:00
parent 86a96dd157
commit f004591c5a
4 changed files with 47 additions and 3 deletions

View File

@ -0,0 +1,26 @@
<?php
use Pest\Plugins\Concerns\HandleArguments;
test('method hasArgument', function (string $argument, bool $expectedResult) {
$obj = new class
{
use HandleArguments;
};
$arguments = [
'--long-argument',
'someValue',
'-a',
'--with-equal-sign=1337',
];
expect($obj->hasArgument($argument, $arguments))->toBe($expectedResult);
})->with([
['--long-argument', true],
['-a', true],
['--with-equal-sign', true],
['someValue', true],
['--a', false],
['--undefined-argument', false],
]);