diff options
Diffstat (limited to 'plugins/TestRunner')
-rw-r--r-- | plugins/TestRunner/Commands/GenerateTravisYmlFile.php | 5 | ||||
-rw-r--r-- | plugins/TestRunner/Commands/TestsRun.php | 4 | ||||
-rw-r--r-- | plugins/TestRunner/Commands/TestsRunUI.php | 24 | ||||
-rw-r--r-- | plugins/TestRunner/Commands/TestsSetupFixture.php | 10 |
4 files changed, 31 insertions, 12 deletions
diff --git a/plugins/TestRunner/Commands/GenerateTravisYmlFile.php b/plugins/TestRunner/Commands/GenerateTravisYmlFile.php index 5e1ac7d181..a99c3ae4f0 100644 --- a/plugins/TestRunner/Commands/GenerateTravisYmlFile.php +++ b/plugins/TestRunner/Commands/GenerateTravisYmlFile.php @@ -39,7 +39,10 @@ class GenerateTravisYmlFile extends ConsoleCommand ->addOption('php-versions', null, InputOption::VALUE_OPTIONAL, "List of PHP versions to test against, ie, 5.4,5.5,5.6. Defaults to: 5.3.3,5.4,5.5,5.6.") ->addOption('dump', null, InputOption::VALUE_REQUIRED, "Debugging option. Saves the output .travis.yml to the specified file.") - ->addOption('repo-root-dir', null, InputOption::VALUE_REQUIRED, "Path to the repo for whom a .travis.yml file will be generated for."); + ->addOption('repo-root-dir', null, InputOption::VALUE_REQUIRED, "Path to the repo for whom a .travis.yml file will be generated for.") + ->addOption('force-php-tests', null, InputOption::VALUE_NONE, "Forces the presence of the PHP tests jobs for plugin builds.") + ->addOption('force-ui-tests', null, InputOption::VALUE_NONE, "Forces the presence of the UI tests jobs for plugin builds.") + ->addOption('sudo-false', null, InputOption::VALUE_NONE, "If supplied, the .travis.yml file will use travis' new infrastructure."); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/plugins/TestRunner/Commands/TestsRun.php b/plugins/TestRunner/Commands/TestsRun.php index 08e456da19..8a12c07e3b 100644 --- a/plugins/TestRunner/Commands/TestsRun.php +++ b/plugins/TestRunner/Commands/TestsRun.php @@ -47,10 +47,6 @@ class TestsRun extends ConsoleCommand // bin is the composer executeable directory, where all vendors (should) place their executables $command = PIWIK_VENDOR_PATH . '/bin/phpunit'; - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $command = 'php -dzend.enable_gc=0 ' . $command; - } - if (!$this->isCoverageEnabled($options) && $this->isXdebugLoaded()) { $message = 'Did you know? You can run tests faster by disabling xdebug'; if($this->isXdebugCodeCoverageEnabled()) { diff --git a/plugins/TestRunner/Commands/TestsRunUI.php b/plugins/TestRunner/Commands/TestsRunUI.php index faf436a8af..3a9a06c080 100644 --- a/plugins/TestRunner/Commands/TestsRunUI.php +++ b/plugins/TestRunner/Commands/TestsRunUI.php @@ -26,7 +26,7 @@ class TestsRunUI extends ConsoleCommand \nRun one spec: \n./console tests:run-ui UIIntegrationTest "); - $this->addArgument('specs', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Run only a specific test spec. Separate multiple specs by comma, for instance core,integration', array()); + $this->addArgument('specs', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Run only a specific test spec. Separate multiple specs by a space, for instance UIIntegrationTest ', array()); $this->addOption("persist-fixture-data", null, InputOption::VALUE_NONE, "Persist test data in a database and do not execute tear down."); $this->addOption('keep-symlinks', null, InputOption::VALUE_NONE, "Keep recursive directory symlinks so test pages can be viewed in a browser."); $this->addOption('print-logs', null, InputOption::VALUE_NONE, "Print webpage logs even if tests succeed."); @@ -35,6 +35,9 @@ class TestsRunUI extends ConsoleCommand $this->addOption('plugin', null, InputOption::VALUE_REQUIRED, "Execute all tests for a plugin."); $this->addOption('core', null, InputOption::VALUE_NONE, "Execute only tests for Piwik core & core plugins."); $this->addOption('skip-delete-assets', null, InputOption::VALUE_NONE, "Skip deleting of merged assets (will speed up a test run, but not by a lot)."); + $this->addOption('screenshot-repo', null, InputOption::VALUE_NONE, "For tests"); + $this->addOption('store-in-ui-tests-repo', null, InputOption::VALUE_NONE, "For tests"); + $this->addOption('extra-options', null, InputOption::VALUE_REQUIRED, "Extra options to pass to phantomjs."); } protected function execute(InputInterface $input, OutputInterface $output) @@ -48,6 +51,9 @@ class TestsRunUI extends ConsoleCommand $plugin = $input->getOption('plugin'); $skipDeleteAssets = $input->getOption('skip-delete-assets'); $core = $input->getOption('core'); + $extraOptions = $input->getOption('extra-options'); + $storeInUiTestsRepo = $input->getOption('store-in-ui-tests-repo'); + $screenshotRepo = $input->getOption('screenshot-repo'); if (!$skipDeleteAssets) { AssetManager::getInstance()->removeMergedAssets(); @@ -84,6 +90,18 @@ class TestsRunUI extends ConsoleCommand $options[] = "--core"; } + if ($storeInUiTestsRepo) { + $options[] = "--store-in-ui-tests-repo"; + } + + if ($screenshotRepo) { + $options[] = "--screenshot-repo"; + } + + if ($extraOptions) { + $options[] = $extraOptions; + } + $options = implode(" ", $options); $specs = implode(" ", $specs); @@ -93,7 +111,9 @@ class TestsRunUI extends ConsoleCommand $output->writeln('Executing command: <info>' . $cmd . '</info>'); $output->writeln(''); - passthru($cmd); + passthru($cmd, $returnCode); + + return $returnCode; } /** diff --git a/plugins/TestRunner/Commands/TestsSetupFixture.php b/plugins/TestRunner/Commands/TestsSetupFixture.php index 510578cb76..565a81122a 100644 --- a/plugins/TestRunner/Commands/TestsSetupFixture.php +++ b/plugins/TestRunner/Commands/TestsSetupFixture.php @@ -154,7 +154,7 @@ class TestsSetupFixture extends ConsoleCommand private function createSymbolicLinksForUITests() { // make sure symbolic links exist (phantomjs doesn't support symlink-ing yet) - foreach (array('libs', 'plugins', 'tests', 'piwik.js') as $linkName) { + foreach (array('libs', 'plugins', 'tests', 'misc', 'piwik.js') as $linkName) { $linkPath = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/' . $linkName; if (!file_exists($linkPath)) { symlink(PIWIK_INCLUDE_PATH . '/' . $linkName, $linkPath); @@ -192,10 +192,7 @@ class TestsSetupFixture extends ConsoleCommand ); foreach ($optionsToOverride as $configOption => $value) { if ($value) { - $configOverride = $testingEnvironment->configOverride; - $configOverride['database_tests'][$configOption] = $configOverride['database'][$configOption] = $value; - $testingEnvironment->configOverride = $configOverride; - + $testingEnvironment->overrideConfig('database_tests', $configOption, $value); Config::getInstance()->database[$configOption] = $value; } } @@ -212,6 +209,7 @@ class TestsSetupFixture extends ConsoleCommand throw new \Exception("Cannot find fixture class '$fixtureClass'."); } + /** @var Fixture $fixture */ $fixture = new $fixtureClass(); $fixture->printToScreen = true; @@ -233,6 +231,8 @@ class TestsSetupFixture extends ConsoleCommand $fixture->extraPluginsToLoad = explode(',', $extraPluginsToLoad); } + $fixture->extraDiEnvironments = array('ui-test'); + return $fixture; } |