2424 */
2525final class EntityProtoConvertersTest extends TestCase
2626{
27+ public static function setUpBeforeClass (): void
28+ {
29+ parent ::setUpBeforeClass ();
30+ mkdir (\ONPHP_TEST_PATH .'Main/data/directory ' , 0755 );
31+ mkdir (\ONPHP_TEST_PATH .'Main/data/directory/inner ' , 0755 );
32+ file_put_contents (\ONPHP_TEST_PATH .'Main/data/directory/inner/textField ' , "wow, it's working! " );
33+ }
34+
35+ public static function tearDownAfterClass (): void
36+ {
37+ parent ::tearDownAfterClass ();
38+ $ callback = function ($ path ) use (&$ callback ) {
39+ if (is_dir ($ path )) {
40+ array_map ($ callback , glob ("$ path* " , GLOB_MARK ));
41+ rmdir ($ path );
42+ } else {
43+ unlink ($ path );
44+ }
45+ };
46+
47+ array_map ($ callback , glob (\ONPHP_TEST_PATH .'Main/data/directory/* ' , GLOB_MARK ));
48+ rmdir (\ONPHP_TEST_PATH .'Main/data/directory/ ' );
49+ }
50+
2751 public function testDirectoryBinder ()
2852 {
2953 $ converter = DirectoryToObjectBinder::create (
@@ -43,7 +67,7 @@ public function testDirectoryBinder()
4367
4468 $ result ->setTextField ($ rand );
4569
46- $ newDirectoryContext = \ONPHP_TEST_PATH .'tests/ Main/data/directory ' ;
70+ $ newDirectoryContext = \ONPHP_TEST_PATH .'Main/data/directory ' ;
4771
4872 $ unconverter = ObjectToDirectoryBinder::create (
4973 Singleton::getInstance (EntityProtoDirectoryItem::class)
@@ -62,7 +86,7 @@ public function testSymlinks()
6286 {
6387 $ this ->createContainers ();
6488
65- $ ringDir = \ONPHP_TEST_PATH .'tests/ Main/data/ring ' ;
89+ $ ringDir = \ONPHP_TEST_PATH .'Main/data/ring ' ;
6690
6791 $ actual = glob ($ ringDir .'/* ' );
6892
@@ -103,7 +127,7 @@ public function testReadSymlinks()
103127 {
104128 $ this ->createContainers ();
105129
106- $ ringDir = \ONPHP_TEST_PATH .'tests/ Main/data/ring ' ;
130+ $ ringDir = \ONPHP_TEST_PATH .'Main/data/ring ' ;
107131
108132 $ converter = DirectoryToObjectBinder::create (
109133 Singleton::getInstance (EntityProtoDirectoryItem::class)
@@ -123,7 +147,7 @@ public function testReadSymlinks()
123147 $ newHead = DirectoryItem::create ()->setId ('newHead ' )->
124148 setInner ($ result ->getInner ());
125149
126- $ newItemTmpDir = \ONPHP_TEST_PATH .'tests/ Main/data/ring.tmp ' ;
150+ $ newItemTmpDir = \ONPHP_TEST_PATH .'Main/data/ring.tmp ' ;
127151 $ saver = $ converter ->makeReverseBuilder ()->
128152 setDirectory ($ newItemTmpDir );
129153
@@ -142,7 +166,7 @@ public function testReadSymlinks()
142166
143167 private function createContainers ()
144168 {
145- $ ringDir = \ONPHP_TEST_PATH .'tests/ Main/data/ring ' ;
169+ $ ringDir = \ONPHP_TEST_PATH .'Main/data/ring ' ;
146170
147171 $ converter = ObjectToDirectoryBinder::create (
148172 Singleton::getInstance (EntityProtoDirectoryItem::class)
0 commit comments