示例#1
0
     });
     it('return argumentName', function () use($option, $optInfo) {
         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();
     });
示例#2
0
     });
     it('return argumentName', function () use($option, $optInfo) {
         expect($option->getArgumentName())->toBe($optInfo['argumentName']);
     });
     it('return value', function () use($option, $optInfo) {
         expect($option->getValue())->toBe(false);
     });
 });
 context('acceptArguments', function () {
     it('returns true if an argument name was defined', function () {
         $option = new ConsoleOption('sname', 'lname', 'desc', 'argname');
         expect($option->acceptsArguments())->toBe(true);
     });
     it('returns true if an argument name was not defined', function () {
         $option = new ConsoleOption('sname', 'lname', 'desc');
         expect($option->acceptsArguments())->toBe(false);
     });
 });
 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())->toBe(true);
     });