@@ 10-32 (lines=23) @@ | ||
7 | use Symfony\Component\Console\Tester\CommandTester; |
|
8 | use Tpg\ExtjsBundle\Command\GenerateRestControllerCommand; |
|
9 | ||
10 | class GenerateRestControllerCommandTest extends \PHPUnit_Framework_TestCase { |
|
11 | public function testGenerateController() { |
|
12 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); |
|
13 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Controller/OrderController.php'); |
|
14 | $kernel = new \AppKernel('test', true); |
|
15 | $app = new Application($kernel); |
|
16 | $app->add(new GenerateRestControllerCommand()); |
|
17 | $kernel->boot(); |
|
18 | $command = $app->find('generate:rest:controller'); |
|
19 | $commandTester = new CommandTester($command); |
|
20 | $commandTester->execute(array( |
|
21 | 'command' => $command->getName(), |
|
22 | '--controller' => 'TestTestBundle:Order', |
|
23 | '--entity' => 'TestTestBundle:Order', |
|
24 | '--mongo' => true, |
|
25 | ), array('interactive'=>false)); |
|
26 | $kernel->shutdown(); |
|
27 | $this->assertTrue(class_exists("\\Test\\TestBundle\\Controller\\OrderController")); |
|
28 | $this->assertFileExists(__DIR__.'/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); |
|
29 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); |
|
30 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Controller/OrderController.php'); |
|
31 | } |
|
32 | } |
@@ 10-31 (lines=22) @@ | ||
7 | use Symfony\Component\Console\Tester\CommandTester; |
|
8 | use Tpg\ExtjsBundle\Command\GenerateRestControllerCommand; |
|
9 | ||
10 | class GenerateRestControllerCommandTest extends \PHPUnit_Framework_TestCase { |
|
11 | public function testGenerateController() { |
|
12 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); |
|
13 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Controller/CarController.php'); |
|
14 | $kernel = new \AppKernel('test', true); |
|
15 | $app = new Application($kernel); |
|
16 | $app->add(new GenerateRestControllerCommand()); |
|
17 | $kernel->boot(); |
|
18 | $command = $app->find('generate:rest:controller'); |
|
19 | $commandTester = new CommandTester($command); |
|
20 | $commandTester->execute(array( |
|
21 | 'command' => $command->getName(), |
|
22 | '--controller' => 'TestTestBundle:Car', |
|
23 | '--entity' => 'TestTestBundle:Car' |
|
24 | ), array('interactive'=>false)); |
|
25 | $kernel->shutdown(); |
|
26 | $this->assertTrue(class_exists("\\Test\\TestBundle\\Controller\\CarController")); |
|
27 | $this->assertFileExists(__DIR__.'/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); |
|
28 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'); |
|
29 | @unlink(__DIR__.'/../../Fixtures/Test/TestBundle/Controller/CarController.php'); |
|
30 | } |
|
31 | } |