Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->getGlobalConfig($input->getOption('config'));
     $output->writeln("<info>Cleaning up " . Configuration::outputDir() . "...</info>");
     FileSystem::doEmptyDir(Configuration::outputDir());
     $output->writeln("Done");
 }
Example #2
0
 public function __construct($options)
 {
     $this->options = $options;
     $this->logDir = Configuration::outputDir();
     $this->settings = array_merge($this->settings, Configuration::config()['coverage']);
     self::$coverage = new \PHP_CodeCoverage();
 }
Example #3
0
 public function __construct()
 {
     $this->config  = Configuration::config();
     $this->logDir = Configuration::outputDir(); // prepare log dir
     $this->phpUnitOverriders();
     parent::__construct();
 }
Example #4
0
 public function __construct($options)
 {
     $this->options = $options;
     $this->logDir = Configuration::outputDir();
     $this->settings = array_merge($this->settings, Configuration::config()['coverage']);
     self::$coverage = new \PHP_CodeCoverage();
     // Apply filter
     $filter = new Filter(self::$coverage);
     $filter->whiteList(Configuration::config())->blackList(Configuration::config());
 }
Example #5
0
 protected function setUp()
 {
     if (!extension_loaded('xdebug')) {
         $this->markTestSkipped('xdebug extension required for c3test.');
     }
     $this->c3 = Configuration::dataDir() . 'claypit/c3.php';
     $this->c3_dir = Codeception\Configuration::outputDir() . 'c3tmp/';
     @mkdir($this->c3_dir, 0777, true);
     $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE'] = 'test';
     $_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG'] = 'debug';
 }
 /**
  * @test
  *
  * @throws \Codeception\Exception\ConfigurationException
  */
 public function hasInstalledVimConfigurationInTargetDirectory()
 {
     $target = Configuration::outputDir() . 'vimConfigTest';
     $this->cleanupFolder($target);
     Debug::debug('<info>Preparing command...</info>');
     $command = $this->getCommand();
     Debug::debug('<info>Preparing question helper...</info>');
     $this->mockQuestionHelper($command, function ($test, $order, ConfirmationQuestion $question) {
         // Pick the first choice
         if ($order == 0) {
             return true;
         }
         throw new UnhandledQuestionException();
     });
     Debug::debug('<info>Executing...</info>');
     $tester = new \Symfony\Component\Console\Tester\CommandTester($command);
     $tester->execute([VimConfigurationInstallCommand::TARGET_DIR_ARGUMENT => $target]);
     $output = $tester->getDisplay();
     Debug::debug($output);
     $finder = new Finder();
     $count = $finder->directories()->ignoreDotFiles(false)->in($target)->count();
     $this->assertNotEquals(0, $count, 'No files have been copied!');
 }
Example #7
0
 /**
  * @test
  *
  * @covers  ::execute
  * @covers  ::configure
  * @covers  ::findTemplates
  * @covers  ::getTemplatesList
  * @covers  ::formatTemplatesList
  * @covers  ::createTemplate
  */
 public function hasCopiedFilesIntoTargetLocation()
 {
     $target = Configuration::outputDir() . 'tmp';
     // Eventual pre-cleanup
     $this->cleanupFolder($target);
     Debug::debug('<info>Preparing command...</info>');
     $command = $this->getCommand();
     Debug::debug('<info>Preparing question helper...</info>');
     $this->mockQuestionHelper($command, function ($test, $order, Question $question) {
         // Pick the first choice
         if ($order == 0) {
             return true;
         }
         throw new UnhandledQuestionException();
     });
     Debug::debug('<info>Executing...</info>');
     $tester = new \Symfony\Component\Console\Tester\CommandTester($command);
     $tester->execute([TemplateCommand::ARGUMENT_PATH_NAME => $target]);
     $output = $tester->getDisplay();
     Debug::debug($output);
     $finder = new Finder();
     $count = $finder->directories()->in($target)->count();
     $this->assertNotEquals(0, $count, 'No files have been copied!');
 }
Example #8
0
 /**
  * @covers            ::check
  * @expectedException InvalidArgumentException
  */
 public function testInvalidCheckMethod()
 {
     $agent = new Agent(['cache_dir' => Configuration::outputDir(), 'lowercase' => true, 'browscap' => ['doAutoUpdate' => false]], 'Invalid');
     $agent->check();
 }
Example #9
0
 public function afterSuite(SuiteEvent $e)
 {
     if (!$this->isEnabled()) {
         return;
     }
     if (!file_exists(Configuration::outputDir() . 'c3tmp/codecoverage.serialized')) {
         if (file_exists(Configuration::outputDir() . 'c3tmp/error.txt')) {
             throw new \RuntimeException(file_get_contents(Configuration::outputDir() . 'c3tmp/error.txt'));
         }
         return;
     }
     $contents = file_get_contents(Configuration::outputDir() . 'c3tmp/codecoverage.serialized');
     $coverage = @unserialize($contents);
     if ($coverage === false) {
         return;
     }
     $this->mergeToPrint($coverage);
 }
Example #10
0
 public function afterSuite(SuiteEvent $e)
 {
     if (!$this->isEnabled()) {
         return;
     }
     $coverageFile = Configuration::outputDir() . 'c3tmp/codecoverage.serialized';
     $retries = 5;
     while (!file_exists($coverageFile) && --$retries >= 0) {
         usleep(0.5 * 1000000);
         // 0.5 sec
     }
     if (!file_exists($coverageFile)) {
         if (file_exists(Configuration::outputDir() . 'c3tmp/error.txt')) {
             throw new \RuntimeException(file_get_contents(Configuration::outputDir() . 'c3tmp/error.txt'));
         }
         return;
     }
     $contents = file_get_contents($coverageFile);
     $coverage = @unserialize($contents);
     if ($coverage === false) {
         return;
     }
     $this->mergeToPrint($coverage);
 }
Example #11
0
 function __construct($options = [])
 {
     $this->options = $options;
     $this->logDir = Configuration::outputDir();
 }
Example #12
0
 public function getLogDir()
 {
     return Config::outputDir();
 }
Example #13
0
 public function _failed(\Codeception\TestCase $test, $fail)
 {
     $output = \Codeception\Configuration::outputDir() . DIRECTORY_SEPARATOR . basename($test->getFileName()) . '.page.debug.html';
     file_put_contents($output, $this->browser->getResponse()->getContent());
 }
Example #14
0
 public function testBug2046()
 {
     $this->module->webDriver = null;
     $this->module->_saveScreenshot(\Codeception\Configuration::outputDir() . 'testshot.png');
 }
Example #15
0
 /**
  * Returns absolute path to the requested object which is expected to be in
  * the log directory of a testing project.
  *
  * @since 1.0.1
  *
  * @param string $appendPath A relative path to the requested object.
  * @return string The absolute path to the object.
  */
 function codecept_log_dir($appendPath = '')
 {
     return \Codeception\Configuration::outputDir() . $appendPath;
 }
 /**
  * Returns output directory.
  *
  * @throws ConfigurationException Thrown if there is Codeception-wide
  *                                problem with output directory
  *                                configuration.
  *
  * @return string Absolute path to output directory.
  * @since 0.1.0
  */
 private function getOutputDirectory()
 {
     $outputDirectory = $this->tryGetOption(OUTPUT_DIRECTORY_PARAMETER, DEFAULT_RESULTS_DIRECTORY);
     $filesystem = new Filesystem();
     if (!$filesystem->isAbsolutePath($outputDirectory)) {
         $outputDirectory = Configuration::outputDir() . $outputDirectory;
     }
     return $outputDirectory;
 }
Example #17
0
 public static function appendToFile($marker)
 {
     $fh = fopen(Configuration::outputDir() . 'order.txt', 'a');
     fwrite($fh, $marker);
 }
Example #18
0
 /**
  * Returns the output directory path
  *
  * @return string
  * @throws \Codeception\Exception\ConfigurationException
  */
 public function outputPath()
 {
     return Configuration::outputDir();
 }
Example #19
0
 protected function retrieveAndPrintXml($suite)
 {
     $destFile = Configuration::outputDir() . $suite . '.remote.coverage.xml';
     file_put_contents($destFile, $this->c3Request('clover'));
 }
 public function testScreenshot()
 {
     $this->module->amOnPage('/');
     @unlink(\Codeception\Configuration::outputDir() . 'testshot.png');
     $testName = "debugTest";
     $this->module->makeScreenshot($testName);
     $this->assertFileExists(\Codeception\Configuration::outputDir() . 'debug/' . $testName . '.png');
     @unlink(\Codeception\Configuration::outputDir() . 'debug/' . $testName . '.png');
     $this->module->_saveScreenshot(\Codeception\Configuration::outputDir() . 'testshot.png');
     $this->assertFileExists(\Codeception\Configuration::outputDir() . 'testshot.png');
     @unlink(\Codeception\Configuration::outputDir() . 'testshot.png');
 }
Example #21
0
<?php

require_once __DIR__ . '/_data/MyGroupHighlighter.php';
require_once __DIR__ . '/_data/VerbosityLevelOutput.php';
require_once __DIR__ . '/_data/MyReportPrinter.php';
@unlink(\Codeception\Configuration::outputDir() . 'order.txt');
$fh = fopen(\Codeception\Configuration::outputDir() . 'order.txt', 'a');
fwrite($fh, 'B');
 protected function _before()
 {
     $this->sourceLicense = Configuration::dataDir() . 'license/MyCustomLicense';
     $this->destinationFolder = Configuration::outputDir();
 }
 /**
  * Get the directory to store temporary files
  *
  * @return string
  */
 public function getTempDirectory()
 {
     return \Codeception\Configuration::outputDir() . 'debug' . DIRECTORY_SEPARATOR;
 }