diff options
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | 15 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php | 22 |
3 files changed, 35 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index 6e938826..3c97a9da 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -31,11 +31,11 @@ install: | |||
31 | 31 | ||
32 | # build coverage only on one build, to speed up results feedbacks | 32 | # build coverage only on one build, to speed up results feedbacks |
33 | before_script: | 33 | before_script: |
34 | - if [[ "$TRAVIS_PHP_VERSION" = "5.6" ]]; then PHPUNIT_FLAGS="--coverage-clover=coverage.clover"; fi; | 34 | - if [[ "$TRAVIS_PHP_VERSION" = "5.6" ]]; then PHPUNIT_FLAGS="--coverage-clover=coverage.clover"; else PHPUNIT_FLAGS=""; fi; |
35 | 35 | ||
36 | script: | 36 | script: |
37 | - ant prepare | 37 | - ant prepare |
38 | - phpunit $PHPUNIT_FLAGS | 38 | - phpunit --exclude-group command-doctrine $PHPUNIT_FLAGS |
39 | 39 | ||
40 | after_script: | 40 | after_script: |
41 | - | | 41 | - | |
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index 64f6c329..f689b532 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Tests\Command; | |||
4 | 4 | ||
5 | use Wallabag\CoreBundle\Tests\WallabagTestCase; | 5 | use Wallabag\CoreBundle\Tests\WallabagTestCase; |
6 | use Wallabag\CoreBundle\Command\InstallCommand; | 6 | use Wallabag\CoreBundle\Command\InstallCommand; |
7 | use Wallabag\CoreBundle\Tests\Mock\InstallCommandMock; | ||
7 | use Symfony\Bundle\FrameworkBundle\Console\Application; | 8 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
8 | use Symfony\Component\Console\Tester\CommandTester; | 9 | use Symfony\Component\Console\Tester\CommandTester; |
9 | use Symfony\Component\Console\Input\ArrayInput; | 10 | use Symfony\Component\Console\Input\ArrayInput; |
@@ -30,7 +31,7 @@ class InstallCommandTest extends WallabagTestCase | |||
30 | $this->container = static::$kernel->getContainer(); | 31 | $this->container = static::$kernel->getContainer(); |
31 | 32 | ||
32 | $application = new Application(static::$kernel); | 33 | $application = new Application(static::$kernel); |
33 | $application->add(new InstallCommand()); | 34 | $application->add(new InstallCommandMock()); |
34 | 35 | ||
35 | $command = $application->find('wallabag:install'); | 36 | $command = $application->find('wallabag:install'); |
36 | 37 | ||
@@ -64,7 +65,7 @@ class InstallCommandTest extends WallabagTestCase | |||
64 | $this->container = static::$kernel->getContainer(); | 65 | $this->container = static::$kernel->getContainer(); |
65 | 66 | ||
66 | $application = new Application(static::$kernel); | 67 | $application = new Application(static::$kernel); |
67 | $application->add(new InstallCommand()); | 68 | $application->add(new InstallCommandMock()); |
68 | 69 | ||
69 | $command = $application->find('wallabag:install'); | 70 | $command = $application->find('wallabag:install'); |
70 | 71 | ||
@@ -97,6 +98,9 @@ class InstallCommandTest extends WallabagTestCase | |||
97 | $this->assertContains('Droping database, creating database and schema', $tester->getDisplay()); | 98 | $this->assertContains('Droping database, creating database and schema', $tester->getDisplay()); |
98 | } | 99 | } |
99 | 100 | ||
101 | /** | ||
102 | * @group command-doctrine | ||
103 | */ | ||
100 | public function testRunInstallCommandWithDatabaseRemoved() | 104 | public function testRunInstallCommandWithDatabaseRemoved() |
101 | { | 105 | { |
102 | $this->container = static::$kernel->getContainer(); | 106 | $this->container = static::$kernel->getContainer(); |
@@ -148,7 +152,7 @@ class InstallCommandTest extends WallabagTestCase | |||
148 | $this->container = static::$kernel->getContainer(); | 152 | $this->container = static::$kernel->getContainer(); |
149 | 153 | ||
150 | $application = new Application(static::$kernel); | 154 | $application = new Application(static::$kernel); |
151 | $application->add(new InstallCommand()); | 155 | $application->add(new InstallCommandMock()); |
152 | 156 | ||
153 | $command = $application->find('wallabag:install'); | 157 | $command = $application->find('wallabag:install'); |
154 | 158 | ||
@@ -181,6 +185,9 @@ class InstallCommandTest extends WallabagTestCase | |||
181 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); | 185 | $this->assertContains('Droping schema and creating schema', $tester->getDisplay()); |
182 | } | 186 | } |
183 | 187 | ||
188 | /** | ||
189 | * @group command-doctrine | ||
190 | */ | ||
184 | public function testRunInstallCommandChooseNothing() | 191 | public function testRunInstallCommandChooseNothing() |
185 | { | 192 | { |
186 | $this->container = static::$kernel->getContainer(); | 193 | $this->container = static::$kernel->getContainer(); |
@@ -242,7 +249,7 @@ class InstallCommandTest extends WallabagTestCase | |||
242 | $this->container = static::$kernel->getContainer(); | 249 | $this->container = static::$kernel->getContainer(); |
243 | 250 | ||
244 | $application = new Application(static::$kernel); | 251 | $application = new Application(static::$kernel); |
245 | $application->add(new InstallCommand()); | 252 | $application->add(new InstallCommandMock()); |
246 | 253 | ||
247 | $command = $application->find('wallabag:install'); | 254 | $command = $application->find('wallabag:install'); |
248 | 255 | ||
diff --git a/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php b/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php new file mode 100644 index 00000000..69bc48e0 --- /dev/null +++ b/src/Wallabag/CoreBundle/Tests/Mock/InstallCommandMock.php | |||
@@ -0,0 +1,22 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Tests\Mock; | ||
4 | |||
5 | use Wallabag\CoreBundle\Command\InstallCommand; | ||
6 | |||
7 | /** | ||
8 | * This mock aims to speed the test of InstallCommand by avoid calling external command | ||
9 | * like all doctrine commands. | ||
10 | * | ||
11 | * This speed the test but as a downside, it doesn't allow to fully test the InstallCommand | ||
12 | * | ||
13 | * Launching tests to avoid doctrine command: | ||
14 | * phpunit --exclude-group command-doctrine | ||
15 | */ | ||
16 | class InstallCommandMock extends InstallCommand | ||
17 | { | ||
18 | protected function runCommand($command, $parameters = array()) | ||
19 | { | ||
20 | return $this; | ||
21 | } | ||
22 | } | ||