You are here

public function InputOptionTest::testModes 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::testModes()

File

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

Class

InputOptionTest

Namespace

Symfony\Component\Console\Tests\Input

Code

public function testModes() {
  $option = new InputOption('foo', 'f');
  $this
    ->assertFalse($option
    ->acceptValue(), '__construct() gives a "InputOption::VALUE_NONE" mode by default');
  $this
    ->assertFalse($option
    ->isValueRequired(), '__construct() gives a "InputOption::VALUE_NONE" mode by default');
  $this
    ->assertFalse($option
    ->isValueOptional(), '__construct() gives a "InputOption::VALUE_NONE" mode by default');
  $option = new InputOption('foo', 'f', null);
  $this
    ->assertFalse($option
    ->acceptValue(), '__construct() can take "InputOption::VALUE_NONE" as its mode');
  $this
    ->assertFalse($option
    ->isValueRequired(), '__construct() can take "InputOption::VALUE_NONE" as its mode');
  $this
    ->assertFalse($option
    ->isValueOptional(), '__construct() can take "InputOption::VALUE_NONE" as its mode');
  $option = new InputOption('foo', 'f', InputOption::VALUE_NONE);
  $this
    ->assertFalse($option
    ->acceptValue(), '__construct() can take "InputOption::VALUE_NONE" as its mode');
  $this
    ->assertFalse($option
    ->isValueRequired(), '__construct() can take "InputOption::VALUE_NONE" as its mode');
  $this
    ->assertFalse($option
    ->isValueOptional(), '__construct() can take "InputOption::VALUE_NONE" as its mode');
  $option = new InputOption('foo', 'f', InputOption::VALUE_REQUIRED);
  $this
    ->assertTrue($option
    ->acceptValue(), '__construct() can take "InputOption::VALUE_REQUIRED" as its mode');
  $this
    ->assertTrue($option
    ->isValueRequired(), '__construct() can take "InputOption::VALUE_REQUIRED" as its mode');
  $this
    ->assertFalse($option
    ->isValueOptional(), '__construct() can take "InputOption::VALUE_REQUIRED" as its mode');
  $option = new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL);
  $this
    ->assertTrue($option
    ->acceptValue(), '__construct() can take "InputOption::VALUE_OPTIONAL" as its mode');
  $this
    ->assertFalse($option
    ->isValueRequired(), '__construct() can take "InputOption::VALUE_OPTIONAL" as its mode');
  $this
    ->assertTrue($option
    ->isValueOptional(), '__construct() can take "InputOption::VALUE_OPTIONAL" as its mode');
}