# build coverage only on one build, to speed up results feedbacks
before_script:
- - if [[ "$TRAVIS_PHP_VERSION" = "5.6" ]]; then PHPUNIT_FLAGS="--coverage-clover=coverage.clover"; fi;
+ - if [[ "$TRAVIS_PHP_VERSION" = "5.6" ]]; then PHPUNIT_FLAGS="--coverage-clover=coverage.clover"; else PHPUNIT_FLAGS=""; fi;
script:
- ant prepare
- - phpunit $PHPUNIT_FLAGS
+ - phpunit --exclude-group command-doctrine $PHPUNIT_FLAGS
after_script:
- |
use Wallabag\CoreBundle\Tests\WallabagTestCase;
use Wallabag\CoreBundle\Command\InstallCommand;
+use Wallabag\CoreBundle\Tests\Mock\InstallCommandMock;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Input\ArrayInput;
$this->container = static::$kernel->getContainer();
$application = new Application(static::$kernel);
- $application->add(new InstallCommand());
+ $application->add(new InstallCommandMock());
$command = $application->find('wallabag:install');
$this->container = static::$kernel->getContainer();
$application = new Application(static::$kernel);
- $application->add(new InstallCommand());
+ $application->add(new InstallCommandMock());
$command = $application->find('wallabag:install');
$this->assertContains('Droping database, creating database and schema', $tester->getDisplay());
}
+ /**
+ * @group command-doctrine
+ */
public function testRunInstallCommandWithDatabaseRemoved()
{
$this->container = static::$kernel->getContainer();
$this->container = static::$kernel->getContainer();
$application = new Application(static::$kernel);
- $application->add(new InstallCommand());
+ $application->add(new InstallCommandMock());
$command = $application->find('wallabag:install');
$this->assertContains('Droping schema and creating schema', $tester->getDisplay());
}
+ /**
+ * @group command-doctrine
+ */
public function testRunInstallCommandChooseNothing()
{
$this->container = static::$kernel->getContainer();
$this->container = static::$kernel->getContainer();
$application = new Application(static::$kernel);
- $application->add(new InstallCommand());
+ $application->add(new InstallCommandMock());
$command = $application->find('wallabag:install');
--- /dev/null
+<?php
+
+namespace Wallabag\CoreBundle\Tests\Mock;
+
+use Wallabag\CoreBundle\Command\InstallCommand;
+
+/**
+ * This mock aims to speed the test of InstallCommand by avoid calling external command
+ * like all doctrine commands.
+ *
+ * This speed the test but as a downside, it doesn't allow to fully test the InstallCommand
+ *
+ * Launching tests to avoid doctrine command:
+ * phpunit --exclude-group command-doctrine
+ */
+class InstallCommandMock extends InstallCommand
+{
+ protected function runCommand($command, $parameters = array())
+ {
+ return $this;
+ }
+}