File tree 1 file changed +44
-0
lines changed
src/Symfony/Component/ClassLoader/Tests 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 15
15
16
16
class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
17
17
{
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
+ }
18
62
19
63
/**
20
64
* @dataProvider getTestCreateMapTests
You can’t perform that action at this time.
0 commit comments