public function test_fix_path() { $config = new PhpunitConfigGenerator(); $original = <<<EOD <phpunit bootstrap="vendor/autoload.php"> <testsuites> <testsuite name="My Test Suite"> <directory>tests/</directory> <directory>/path/to/tests/*Test.php</directory> <file>path/to/MyTest.php</file> <exclude>path/to/exclude</exclude> </testsuite> </testsuites> </phpunit> EOD; $expected = <<<EOD <phpunit bootstrap="../vendor/autoload.php"> <testsuites> <testsuite name="My Test Suite"> <directory>../tests</directory> <directory>/path/to/tests/*Test.php</directory> <file>../path/to/MyTest.php</file> <exclude>../path/to/exclude</exclude> </testsuite> </testsuites> <listeners> <listener class="iakio\\phpunit\\smartrunner\\DependencyListener"></listener> </listeners> </phpunit> EOD; $this->assertXmlStringEqualsXmlString($expected, $config->generate($original, '..')); }
public function test_invoke_generator_with_original_content_if_argument_is_passed() { $original_file = $this->root->url() . '/phpunit.xml.dist'; $original_content = '<phpunit colors="true"><listeners><listener class="MyListener"></listener></listeners></phpunit>'; file_put_contents($original_file, $original_content); $this->expectOutputString($this->path("Creating .smartrunner/config.php.\n" . "Creating .smartrunner/phpunit.xml.dist.\n")); $this->phpunit_config_generator->generate($original_content, '..')->shouldBeCalled(); $this->command->run([$original_file]); }
private function phpunitConfig(array $argv) { if (count($argv) > 0) { $original = file_get_contents($argv[0]); $fix = Path::canonicalize('../' . $this->fs->relativePath(dirname($argv[0]))); } else { $original = '<phpunit />'; $fix = null; } return $this->phpunit_config_generator->generate($original, $fix); }