$this->assertTrue($command->getDefinition()->hasOption('foo'), '->addOption() adds an option to the command');
}
+ public function testSetHidden()
+ {
+ $command = new \TestCommand();
+ $command->setHidden(true);
+ $this->assertTrue($command->isHidden());
+ }
+
public function testGetNamespaceGetNameSetName()
{
$command = new \TestCommand();
/**
* @dataProvider getSetCodeBindToClosureTests
- * @requires PHP 5.4
*/
public function testSetCodeBindToClosure($previouslyBound, $expected)
{
$this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Invalid callable provided to Command::setCode.
- */
- public function testSetCodeWithNonCallable()
- {
- $command = new \TestCommand();
- $command->setCode(array($this, 'nonExistentMethod'));
- }
-
public function callableMethodCommand(InputInterface $input, OutputInterface $output)
{
$output->writeln('from the code...');
}
-
- /**
- * @group legacy
- */
- public function testLegacyAsText()
- {
- $command = new \TestCommand();
- $command->setApplication(new Application());
- $tester = new CommandTester($command);
- $tester->execute(array('command' => $command->getName()));
- $this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command');
- }
-
- /**
- * @group legacy
- */
- public function testLegacyAsXml()
- {
- $command = new \TestCommand();
- $command->setApplication(new Application());
- $tester = new CommandTester($command);
- $tester->execute(array('command' => $command->getName()));
- $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command');
- }
}
// In order to get an unbound closure, we should create it outside a class