Exemplo n.º 1
0
 function testManifest()
 {
     $baseFolder = TEMP_FOLDER . '/manifest-test';
     $manifestInfo = ManifestBuilder::get_manifest_info($baseFolder);
     global $project;
     $this->assertEquals("{$baseFolder}/sapphire/MyClass.php", $manifestInfo['globals']['_CLASS_MANIFEST']['MyClass']);
     $this->assertEquals("{$baseFolder}/sapphire/subdir/SubDirClass.php", $manifestInfo['globals']['_CLASS_MANIFEST']['SubDirClass']);
     $this->assertNotContains('OtherFile', array_keys($manifestInfo['globals']['_CLASS_MANIFEST']));
     $this->assertContains('MyClass', array_keys($manifestInfo['globals']['_ALL_CLASSES']['exists']));
     $this->assertContains('MyClass_Other', array_keys($manifestInfo['globals']['_ALL_CLASSES']['exists']));
     $this->assertContains('MyClass_Final', array_keys($manifestInfo['globals']['_ALL_CLASSES']['exists']));
     $this->assertContains('MyClass_ClassBetweenTwoStrings', array_keys($manifestInfo['globals']['_ALL_CLASSES']['exists']));
     // Check aspects of PHP file
     $manifest = ManifestBuilder::generate_php_file($manifestInfo);
     // Debug::message($manifest);
     $this->assertEquals(1, preg_match('/^<\\?php/', $manifest), "Starts with <?php");
     $this->assertEquals(1, preg_match('/\\$_CLASS_MANIFEST\\s*=\\s*array/m', $manifest), "\$_CLASS_MANIFEST exists");
     $this->assertEquals(1, preg_match('/\\$_TEMPLATE_MANIFEST\\s*=\\s*array/m', $manifest), "\$_TEMPLATE_MANIFEST exists");
     $this->assertEquals(1, preg_match('/\\$_CSS_MANIFEST\\s*=\\s*array/m', $manifest), "\$_CSS_MANIFEST exists");
     $this->assertEquals(1, preg_match('/\\$_ALL_CLASSES\\s*=\\s*array/m', $manifest), "\$_ALL_CLASSES exists");
     $this->assertEquals(1, preg_match('/require_once\\("[^"]+rahbeast\\/_config.php"\\);/i', $manifest), "rahbeast/_config.php included");
     $this->assertEquals(1, preg_match('/require_once\\("[^"]+sapphire\\/_config.php"\\);/i', $manifest), "sapphire/_config.php included");
 }