Esempio n. 1
0
            expect($option->getArgumentName())->toBe($optInfo['argumentName']);
        });
        it('return value', function () use($option, $optInfo) {
            expect($option->getValue())->toBeFalse();
        });
    });
    context('acceptArguments', function () {
        it('returns true if an argument name was defined', function () {
            $option = new ConsoleOption('sname', 'lname', 'desc', 'argname');
            expect($option->acceptsArguments())->toBeTrue();
        });
        it('returns true if an argument name was not defined', function () {
            $option = new ConsoleOption('sname', 'lname', 'desc');
            expect($option->acceptsArguments())->toBeFalse();
        });
    });
    context('setValue', function () {
        it('sets the value if the option accepts arguments', function () {
            $option = new ConsoleOption('sname', 'lname', 'desc', 'argname');
            $value = 'test';
            $option->setValue($value);
            expect($option->getValue())->toBe($value);
        });
        it('casts the value to boolean if the option does not', function () {
            $option = new ConsoleOption('sname', 'lname', 'desc');
            $value = 'test';
            $option->setValue($value);
            expect($option->getValue())->toBeTrue();
        });
    });
});