8000 dump test · symfony/symfony@f1970fa · GitHub
[go: up one dir, main page]

Skip to content

Commit f1970fa

Browse files
author
Michal Piotrowski
committed
dump test
fix things pointed out by stof fix things pointed out by pborreli fix things pointed out by fabpot
1 parent 2c0e851 commit f1970fa

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