public function testIsArray() { $option = new InputOption('foo', null, InputOption::PARAMETER_OPTIONAL | InputOption::PARAMETER_IS_ARRAY); $this->assertTrue($option->isArray(), '->isArray() returns true if the option can be an array'); $option = new InputOption('foo', null, InputOption::PARAMETER_NONE); $this->assertFalse($option->isArray(), '->isArray() returns false if the option can not be an array'); }
try { $option = new InputOption('foo', 'f', 'ANOTHER_ONE'); $t->fail('__construct() throws an Exception if the mode is not valid'); } catch (\Exception $e) { $t->pass('__construct() throws an Exception if the mode is not valid'); } // ->isArray() $t->diag('->isArray()'); $option = new InputOption('foo', null, InputOption::PARAMETER_OPTIONAL | InputOption::PARAMETER_IS_ARRAY); $t->ok($option->isArray(), '->isArray() returns true if the option can be an array'); $option = new InputOption('foo', null, InputOption::PARAMETER_NONE); $t->ok(!$option->isArray(), '->isArray() returns false if the option can not be an array'); // ->getDescription() $t->diag('->getDescription()'); $option = new InputOption('foo', 'f', null, 'Some description'); $t->is($option->getDescription(), 'Some description', '->getDescription() returns the description message'); // ->getDefault() $t->diag('->getDefault()'); $option = new InputOption('foo', null, InputOption::PARAMETER_OPTIONAL, '', 'default'); $t->is($option->getDefault(), 'default', '->getDefault() returns the default value'); $option = new InputOption('foo', null, InputOption::PARAMETER_REQUIRED, '', 'default'); $t->is($option->getDefault(), 'default', '->getDefault() returns the default value'); $option = new InputOption('foo', null, InputOption::PARAMETER_REQUIRED);