/** * @return SolutionInterface */ public function getSolution() { return DirectorySolution::fromDirectory(__DIR__ . '/../../exercises/concerned-about-separation/solution'); }
public function testExceptionsWithNestedDirectories() { $tempPath = sprintf('%s/%s', realpath(sys_get_temp_dir()), $this->getName()); @mkdir($tempPath, 0775, true); @mkdir(sprintf('%s/nested', $tempPath), 0775, true); @mkdir(sprintf('%s/nested/deep', $tempPath), 0775, true); @mkdir(sprintf('%s/vendor', $tempPath), 0775, true); @mkdir(sprintf('%s/vendor/somelib', $tempPath), 0775, true); touch(sprintf('%s/solution.php', $tempPath)); touch(sprintf('%s/some-class.php', $tempPath)); touch(sprintf('%s/exclude.txt', $tempPath)); touch(sprintf('%s/nested/exclude.txt', $tempPath)); touch(sprintf('%s/nested/deep/exclude.txt', $tempPath)); touch(sprintf('%s/vendor/somelib/app.php', $tempPath)); $exclusions = ['exclude.txt', 'vendor']; $solution = DirectorySolution::fromDirectory($tempPath, $exclusions); $this->assertSame(sprintf('%s/solution.php', $tempPath), $solution->getEntryPoint()); $this->assertInternalType('array', $solution->getFiles()); $files = $solution->getFiles(); $this->assertCount(2, $files); $this->assertSame(sprintf('%s/solution.php', $tempPath), $files[0]->__toString()); $this->assertSame(sprintf('%s/some-class.php', $tempPath), $files[1]->__toString()); unlink(sprintf('%s/solution.php', $tempPath)); unlink(sprintf('%s/some-class.php', $tempPath)); unlink(sprintf('%s/exclude.txt', $tempPath)); unlink(sprintf('%s/nested/exclude.txt', $tempPath)); unlink(sprintf('%s/nested/deep/exclude.txt', $tempPath)); unlink(sprintf('%s/vendor/somelib/app.php', $tempPath)); rmdir(sprintf('%s/nested/deep', $tempPath)); rmdir(sprintf('%s/nested', $tempPath)); rmdir(sprintf('%s/vendor/somelib', $tempPath)); rmdir(sprintf('%s/vendor', $tempPath)); rmdir($tempPath); }
/** * @return SolutionInterface */ public function getSolution() { return DirectorySolution::fromDirectory(__DIR__ . '/../../exercises/dependency-heaven/solution'); }