You are here

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

File

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

Class

InputOptionTest

Namespace

Symfony\Component\Console\Tests\Input

Code

public function testSetDefault() {
  $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED, '', 'default');
  $option
    ->setDefault(null);
  $this
    ->assertNull($option
    ->getDefault(), '->setDefault() can reset the default value by passing null');
  $option
    ->setDefault('another');
  $this
    ->assertEquals('another', $option
    ->getDefault(), '->setDefault() changes the default value');
  $option = new InputOption('foo', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY);
  $option
    ->setDefault(array(
    1,
    2,
  ));
  $this
    ->assertEquals(array(
    1,
    2,
  ), $option
    ->getDefault(), '->setDefault() changes the default value');
}