Ejemplo n.º 1
0
 public function testSetFetInteractive()
 {
     $input = new ArrayInput(array());
     $this->assertTrue($input->isInteractive(), '->isInteractive() returns whether the input should be interactive or not');
     $input->setInteractive(false);
     $this->assertTrue(!$input->isInteractive(), '->setInteractive() changes the interactive flag');
 }
Ejemplo n.º 2
0
try
{
  $input->validate();
  $t->fail('->validate() throws a \RuntimeException if not enough arguments are given');
}
catch (\RuntimeException $e)
{
  $t->pass('->validate() throws a \RuntimeException if not enough arguments are given');
}

$input = new ArrayInput(array('name' => 'foo'));
$input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED))));

try
{
  $input->validate();
  $t->pass('->validate() does not throw a \RuntimeException if enough arguments are given');
}
catch (\RuntimeException $e)
{
  $t->fail('->validate() does not throw a \RuntimeException if enough arguments are given');
}

// ->setInteractive() ->isInteractive()
$t->diag('->setInteractive() ->isInteractive()');
$input = new ArrayInput(array());
$t->ok($input->isInteractive(), '->isInteractive() returns whether the input should be interactive or not');
$input->setInteractive(false);
$t->ok(!$input->isInteractive(), '->setInteractive() changes the interactive flag');