1
|
|
|
<?php |
2
|
|
|
namespace OpenOrchestra\FunctionalTests; |
3
|
|
|
|
4
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application; |
5
|
|
|
use Symfony\Component\Console\Input\ArrayInput; |
6
|
|
|
use Symfony\Component\Console\Output\ConsoleOutput; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class TestListener |
10
|
|
|
*/ |
11
|
|
|
class TestListener extends \PHPUnit_Framework_BaseTestListener |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @param PHPUnit_Framework_TestSuite $suite |
15
|
|
|
*/ |
16
|
|
|
public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) |
17
|
|
|
{ |
18
|
|
|
if (strpos($suite->getName(),"functional") !== false ) { |
19
|
|
|
|
20
|
|
|
$noParametersInput = new ArrayInput(array()); |
21
|
|
|
$consoleOutput = new ConsoleOutput(); |
22
|
|
|
|
23
|
|
|
$kernel = new \AppKernel('test', true); // create a "test" kernel |
24
|
|
|
$kernel->boot(); |
25
|
|
|
|
26
|
|
|
$application = new Application($kernel); |
27
|
|
|
|
28
|
|
|
$consoleOutput->writeln(sprintf('<comment>%s</comment>', 'console cache:clear --env=test')); |
29
|
|
|
$command = $application->find('cache:clear'); |
30
|
|
|
$command->run($noParametersInput, $consoleOutput); |
31
|
|
|
|
32
|
|
|
$consoleOutput->writeln(sprintf('<comment>%s</comment>', 'console orchestra:mongodb:fixtures:load --env=test --type=functional')); |
33
|
|
|
$command = $application->find('orchestra:mongodb:fixtures:load'); |
34
|
|
|
$command->run(new ArrayInput(array( |
35
|
|
|
'--type' => 'functional' |
36
|
|
|
)), $consoleOutput); |
37
|
|
|
|
38
|
|
|
$consoleOutput->writeln(sprintf('<comment>%s</comment>', 'console orchestra:elastica:index:drop')); |
39
|
|
|
$command = $application->find('orchestra:elastica:index:drop'); |
40
|
|
|
$command->run($noParametersInput, $consoleOutput); |
41
|
|
|
|
42
|
|
|
$consoleOutput->writeln(sprintf('<comment>%s</comment>', 'console orchestra:elastica:index:create')); |
43
|
|
|
$command = $application->find('orchestra:elastica:index:create'); |
44
|
|
|
$command->run($noParametersInput, $consoleOutput); |
45
|
|
|
|
46
|
|
|
$consoleOutput->writeln(sprintf('<comment>%s</comment>', 'console orchestra:elastica:schema:create')); |
47
|
|
|
$command = $application->find('orchestra:elastica:schema:create'); |
48
|
|
|
$command->run($noParametersInput, $consoleOutput); |
49
|
|
|
|
50
|
|
|
$consoleOutput->writeln(sprintf('<comment>%s</comment>', 'console orchestra:elastica:populate')); |
51
|
|
|
$command = $application->find('orchestra:elastica:populate'); |
52
|
|
|
$command->run($noParametersInput, $consoleOutput); |
53
|
|
|
|
54
|
|
|
$consoleOutput->writeln(sprintf('<comment>%s</comment>', 'phpunit --testsuite=functional')); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|