You are here

public function InputArgumentTest::testSetDefault in Zircon Profile 8

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

File

vendor/symfony/console/Tests/Input/InputArgumentTest.php, line 79

Class

InputArgumentTest

Namespace

Symfony\Component\Console\Tests\Input

Code

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