[Console] Removed the descriptor from data set providers.

This commit is contained in:
Jakub Zalas 2013-05-14 07:06:04 +01:00
parent 89c25911a9
commit 0617ed16ce

View File

@ -21,31 +21,31 @@ use Symfony\Component\Console\Input\InputOption;
abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
{ {
/** @dataProvider getDescribeInputArgumentTestData */ /** @dataProvider getDescribeInputArgumentTestData */
public function testDescribeInputArgument(DescriptorInterface $descriptor, InputArgument $argument, $expectedDescription) public function testDescribeInputArgument(InputArgument $argument, $expectedDescription)
{ {
$this->assertEquals(trim($expectedDescription), trim($descriptor->describe($argument))); $this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($argument)));
} }
/** @dataProvider getDescribeInputOptionTestData */ /** @dataProvider getDescribeInputOptionTestData */
public function testDescribeInputOption(DescriptorInterface $descriptor, InputOption $option, $expectedDescription) public function testDescribeInputOption(InputOption $option, $expectedDescription)
{ {
$this->assertEquals(trim($expectedDescription), trim($descriptor->describe($option))); $this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($option)));
} }
/** @dataProvider getDescribeInputDefinitionTestData */ /** @dataProvider getDescribeInputDefinitionTestData */
public function testDescribeInputDefinition(DescriptorInterface $descriptor, InputDefinition $definition, $expectedDescription) public function testDescribeInputDefinition(InputDefinition $definition, $expectedDescription)
{ {
$this->assertEquals(trim($expectedDescription), trim($descriptor->describe($definition))); $this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($definition)));
} }
/** @dataProvider getDescribeCommandTestData */ /** @dataProvider getDescribeCommandTestData */
public function testDescribeCommand(DescriptorInterface $descriptor, Command $command, $expectedDescription) public function testDescribeCommand(Command $command, $expectedDescription)
{ {
$this->assertEquals(trim($expectedDescription), trim($descriptor->describe($command))); $this->assertEquals(trim($expectedDescription), trim($this->getDescriptor()->describe($command)));
} }
/** @dataProvider getDescribeApplicationTestData */ /** @dataProvider getDescribeApplicationTestData */
public function testDescribeApplication(DescriptorInterface $descriptor, Application $application, $expectedDescription) public function testDescribeApplication(Application $application, $expectedDescription)
{ {
// Replaces the dynamic placeholders of the command help text with a static version. // Replaces the dynamic placeholders of the command help text with a static version.
// The placeholder %command.full_name% includes the script path that is not predictable // The placeholder %command.full_name% includes the script path that is not predictable
@ -54,7 +54,7 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
$command->setHelp(str_replace('%command.full_name%', 'app/console %command.name%', $command->getHelp())); $command->setHelp(str_replace('%command.full_name%', 'app/console %command.name%', $command->getHelp()));
} }
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $descriptor->describe($application)))); $this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $this->getDescriptor()->describe($application))));
} }
public function getDescribeInputArgumentTestData() public function getDescribeInputArgumentTestData()
@ -90,7 +90,7 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
$data = array(); $data = array();
foreach ($objects as $name => $object) { foreach ($objects as $name => $object) {
$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat())); $description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat()));
$data[] = array($this->getDescriptor(), $object, $description); $data[] = array($object, $description);
} }
return $data; return $data;