You are here

public function InputOptionTest::testGetDefault in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Tests/Input/InputOptionTest.php \Symfony\Component\Console\Tests\Input\InputOptionTest::testGetDefault()

File

vendor/symfony/console/Tests/Input/InputOptionTest.php, line 131

Class

InputOptionTest

Namespace

Symfony\Component\Console\Tests\Input

Code

public function testGetDefault() {
  $option = new InputOption('foo', null, InputOption::VALUE_OPTIONAL, '', 'default');
  $this
    ->assertEquals('default', $option
    ->getDefault(), '->getDefault() returns the default value');
  $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED, '', 'default');
  $this
    ->assertEquals('default', $option
    ->getDefault(), '->getDefault() returns the default value');
  $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED);
  $this
    ->assertNull($option
    ->getDefault(), '->getDefault() returns null if no default value is configured');
  $option = new InputOption('foo', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY);
  $this
    ->assertEquals(array(), $option
    ->getDefault(), '->getDefault() returns an empty array if option is an array');
  $option = new InputOption('foo', null, InputOption::VALUE_NONE);
  $this
    ->assertFalse($option
    ->getDefault(), '->getDefault() returns false if the option does not take a value');
}