]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
sqlite doesn't support getListDatabasesSQL
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tests / Command / InstallCommandTest.php
CommitLineData
0bf99bb1
J
1<?php
2
3namespace Wallabag\CoreBundle\Tests\Command;
4
5use Wallabag\CoreBundle\Tests\WallabagTestCase;
6use Wallabag\CoreBundle\Command\InstallCommand;
7use Symfony\Bundle\FrameworkBundle\Console\Application;
8use Symfony\Component\Console\Tester\CommandTester;
9use Symfony\Component\Console\Input\ArrayInput;
10use Symfony\Component\Console\Output\NullOutput;
11
12class InstallCommandTest extends WallabagTestCase
13{
14 public function tearDown()
15 {
16 parent::tearDown();
17
18 $application = new Application(static::$kernel);
19 $application->setAutoExit(false);
20
21 $code = $application->run(new ArrayInput(array(
22 'command' => 'doctrine:fixtures:load',
23 '--no-interaction' => true,
24 '--env' => 'test',
25 )), new NullOutput());
26 }
27
28 public function testRunInstallCommand()
29 {
30 $this->container = static::$kernel->getContainer();
31
32 $application = new Application(static::$kernel);
33 $application->add(new InstallCommand());
34
35 $command = $application->find('wallabag:install');
36
37 // We mock the DialogHelper
38 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper')
39 ->disableOriginalConstructor()
40 ->getMock();
41 $dialog->expects($this->any())
42 ->method('ask')
43 ->will($this->returnValue('test'));
44 $dialog->expects($this->any())
45 ->method('askConfirmation')
46 ->will($this->returnValue(true));
47
48 // We override the standard helper with our mock
49 $command->getHelperSet()->set($dialog, 'dialog');
50
51 $tester = new CommandTester($command);
52 $tester->execute(array(
732c2ad8 53 'command' => $command->getName(),
0bf99bb1
J
54 ));
55
56 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
57 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
58 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
59 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
60 }
61}