8000 merged branch eventhorizonpl/100pc_symfony_component_class_loader_p2 … · symfony/symfony@c0590bf · GitHub
[go: up one dir, main page]

Skip to content

Commit c0590bf

Browse files
committed
merged branch eventhorizonpl/100pc_symfony_component_class_loader_p2 (PR #5330)
Commits ------- f1970fa dump test Discussion ---------- Symfony\Component\ClassLoader\ClassMapGenerator dump test Hi, 100 percent test coverage for ClassMapGenerator :) Best regards, Michal --------------------------------------------------------------------------- by eventhorizonpl at 2012-08-24T07:47:24Z Fixed, thanks for the review!
2 parents 66a060d + f1970fa commit c0590bf

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,50 @@
1515

1616
class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
1717
{
18+
/**
19+
* @var string $workspace
20+
*/
21+
private $workspace = null;
22+
23+
public function prepare_workspace()
24+
{
25+
$this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000);
26+
mkdir($this->workspace, 0777, true);
27+
$this->workspace = realpath($this->workspace);
28+
}
29+
30+
/**
31+
* @param string $file
32+
*/
33+
private function clean($file)
34+
{
35+
if (is_dir($file) && !is_link($file)) {
36+
$dir = new \FilesystemIterator($file);
37+
foreach ($dir as $childFile) {
38+
$this->clean($childFile);
39+
}
40+
41+
rmdir($file);
42+
} else {
43+
unlink($file);
44+
}
45+
}
46+
47+
/**
48+
* @dataProvider getTestCreateMapTests
49+
*/
50+
public function testDump($directory, $expected)
51+
{
52+
$this->prepare_workspace();
53+
54+
$file = $this->workspace.'/file';
55+
56+
$generator = new ClassMapGenerator();
57+
$generator->dump($directory, $file);
58+
$this->assertFileExists($file);
59+
60+
$this->clean($this->workspace);
61+
}
1862

1963
/**
2064
* @dataProvider getTestCreateMapTests

0 commit comments

Comments
 (0)
0