N98\Magento\Command\Developer\ClassLookupCommandTest::testExecute PHP Метод

testExecute() публичный Метод

Test that the class lookup command resolves to the expected Magento class, and optionally whether it outputs a notice informing that the class doesn't exist
public testExecute ( string $type, string $name, string $expected, boolean $exists )
$type string Model, helper, block
$name string Magento dev code
$expected string Resolved class name
$exists boolean Whether the resolved class should exist
    public function testExecute($type, $name, $expected, $exists)
    {
        $application = $this->getApplication();
        $application->add(new ClassLookupCommand());
        $command = $this->getApplication()->find('dev:class:lookup');
        $commandTester = new CommandTester($command);
        $commandTester->execute(array('command' => $command->getName(), 'type' => $type, 'name' => $name));
        $output = $commandTester->getDisplay();
        $this->assertRegExp(sprintf('/%s/', $expected), $output);
        $existsAssertion = !$exists ? 'assertRegExp' : 'assertNotRegExp';
        $this->{$existsAssertion}(sprintf('/%s/', 'does not exist'), $output);
    }