コード例 #1
0
 /**
  * Useful for writing unit tests without hardcoding folder structures.
  *
  * @return String Absolute path to current class.
  */
 protected function getCurrentAbsolutePath()
 {
     $filename = self::$test_class_manifest->getItemPath(get_class($this));
     if (!$filename) {
         throw new LogicException("getItemPath returned null for " . get_class($this));
     }
     return dirname($filename);
 }
 public function testGetModules()
 {
     $expect = array("module" => "{$this->base}/module", "moduleb" => "{$this->base}/moduleb");
     $this->assertEquals($expect, $this->manifest->getModules());
 }
 public function testNamespaceDefParser()
 {
     $parser = ClassManifest::get_namespace_parser();
     $namespacedTokens = $this->getNamespaceTokens();
     $tokens = $this->getTokens();
     $namespacedMatches = $parser->findAll($namespacedTokens);
     $matches = $parser->findAll($tokens);
     $this->assertEquals(array(), $matches);
     $this->assertEquals(array('silverstripe', '\\', 'test'), $namespacedMatches[0]['namespaceName']);
 }