public function testConvertNamespaces()
 {
     $filesystemName = __CLASS__;
     $this->createFilesystem($filesystemName);
     $this->assertFileExists($this->getFilesystemStream('index.php'));
     $this->assertFileExists($this->getFilesystemStream('included_file.php'));
     $this->assertFileExists($this->getFilesystemStream('included_file2.php'));
     $startFile = $this->getFilesystemStream('index.php');
     $outPath = $this->tmpDir . '/' . self::sanitizeFilename(__METHOD__ . '.php');
     $combine = PhpFileCombine::init()->parseFile($startFile)->traverse()->prettyPrint(true)->writeFile($outPath);
     $this->assertFileHasNoErrors($outPath);
     $this->assertTrue($combine->isParsed("vfs://{$filesystemName}/index.php"));
     $this->assertTrue($combine->isParsed("vfs://{$filesystemName}/included_file.php"));
     $this->assertTrue($combine->isParsed("vfs://{$filesystemName}/included_file2.php"));
     $outCode = $combine->getPrettyCode();
     $this->assertGreaterThanOrEqual(1, $c = (int) @preg_match_all($search = '~//comment before require~', $outCode), "Text '{$search}' not found");
     $this->assertGreaterThanOrEqual(1, $c = (int) @preg_match_all($search = '~//comment before require namespaced file~', $outCode), "Text '{$search}' not found");
     $this->assertGreaterThanOrEqual(1, $c = (int) @preg_match_all($search = '~//comment in required namespaced file~', $outCode), "Text '{$search}' not found");
 }
 /**
  * Require level 10
  */
 public function test10LevelsRequire()
 {
     $structure = (require $this->filesystemDir . '/test10LevelsRequire.php');
     array_walk_recursive($structure, array('parent', 'interlaceTree'), ['structure' => $structure, 'depthLimit' => 10]);
     $this->createFilesystem('test10LevelsRequire', $structure);
     $this->assertFileExists($this->getFilesystemStream('index.php'));
     $this->assertFileExists($this->getFilesystemStream('filename1-level-1.php'));
     $this->assertFileExists($this->getFilesystemStream('level-1/filename2-level-2.php'));
     $this->assertFileExists($this->getFilesystemStream('level-1/level-2/level-3/level-4/filename2-level-5.php'));
     $this->assertFileExists($this->getFilesystemStream('level-1/level-2/level-3/level-4/level-5/level-6/level-7/level-8/level-9/filename1-level-10.php'));
     $startFile = $this->getFilesystemStream('index.php');
     $outPath = $this->tmpDir . '/' . self::sanitizeFilename(__METHOD__ . '.php');
     $combine = PhpFileCombine::init()->parseFile($startFile)->traverse()->prettyPrint(true)->writeFile($outPath);
     $this->assertFileHasNoErrors($outPath);
     $this->assertTrue($combine->isParsed('vfs://test10LevelsRequire/index.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsRequire/filename1-level-1.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsRequire/level-1/filename2-level-2.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsRequire/level-1/level-2/level-3/level-4/filename2-level-5.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsRequire/level-1/level-2/level-3/level-4/level-5/level-6/level-7/level-8/level-9/filename1-level-10.php'));
 }
 /**
  * IncludeOnce level 10
  */
 public function test10LevelsIncludeOnce()
 {
     $structure = (require $this->filesystemDir . '/test10LevelsIncludeOnce.php');
     array_walk_recursive($structure, array('parent', 'interlaceTree'), ['structure' => $structure, 'depthLimit' => 10]);
     $this->createFilesystem('test10LevelsIncludeOnce', $structure);
     $this->assertFileExists($this->getFilesystemStream('index.php'));
     $this->assertFileExists($this->getFilesystemStream('filename1-level-1.php'));
     $this->assertFileExists($this->getFilesystemStream('level-1/filename2-level-2.php'));
     $this->assertFileExists($this->getFilesystemStream('level-1/level-2/level-3/level-4/filename2-level-5.php'));
     $this->assertFileExists($this->getFilesystemStream('level-1/level-2/level-3/level-4/level-5/level-6/level-7/level-8/level-9/filename1-level-10.php'));
     $startFile = $this->getFilesystemStream('index.php');
     $outPath = $this->tmpDir . '/' . self::sanitizeFilename(__METHOD__ . '.php');
     $this->assertInstanceOf('cakebake\\combiner\\PhpFileCombine', $combine = PhpFileCombine::init()->parseFile($startFile)->traverse()->prettyPrint(true)->writeFile($outPath));
     $this->assertFileHasNoErrors($outPath);
     $this->assertTrue($combine->isParsed('vfs://test10LevelsIncludeOnce/index.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsIncludeOnce/filename1-level-1.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsIncludeOnce/level-1/filename2-level-2.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsIncludeOnce/level-1/level-2/level-3/level-4/filename2-level-5.php'));
     $this->assertTrue($combine->isParsed('vfs://test10LevelsIncludeOnce/level-1/level-2/level-3/level-4/level-5/level-6/level-7/level-8/level-9/filename1-level-10.php'));
     $this->assertEquals(preg_match_all('~hello filename1-level-1.php~', $combine->getPrettyCode()), 1, 'String "hello filename1-level-1.php" may occure only once');
 }