Example #1
0
 /**
  * Returns the full path to the views directory being used. This will change based on the
  * current site directory or if another module modifies the path via View::setPath.
  *
  * @return string Full path to current views directory
  */
 public static function getPath()
 {
     if (is_null(self::$_path)) {
         self::$_path = Site::getPath() . Config::get('view.dir');
     }
     return self::$_path;
 }
Example #2
0
 /**
  * @covers Site::setPath
  */
 public function testSetPath()
 {
     $site = new Site();
     $path = 'TestPath/$1';
     $site->setPath('foo', $path);
     $this->assertEquals($path, $site->getPath('foo'));
 }
 /**
  * @dataProvider instanceProvider
  * @param Site $site
  */
 public function testSetAndRemovePath(Site $site)
 {
     $count = count($site->getAllPaths());
     $site->setPath('spam', 'http://www.wikidata.org/$1');
     $site->setPath('spam', 'http://www.wikidata.org/foo/$1');
     $site->setPath('foobar', 'http://www.wikidata.org/bar/$1');
     $this->assertEquals($count + 2, count($site->getAllPaths()));
     $this->assertInternalType('string', $site->getPath('foobar'));
     $this->assertEquals('http://www.wikidata.org/foo/$1', $site->getPath('spam'));
     $site->removePath('spam');
     $site->removePath('foobar');
     $this->assertEquals($count, count($site->getAllPaths()));
     $this->assertFalse($site->getPath('foobar'));
     $this->assertFalse($site->getPath('spam'));
 }
Example #4
0
 /**
  * Returns an array of paths to be searched for modules. This also determines where
  * modules are loaded from.
  */
 public static function getModulePaths()
 {
     if (!self::$_modulePaths) {
         self::$_modulePaths = array(ROOT . 'modules/', ROOT . 'core/');
         $sitePath = Site::getPath() . 'modules/';
         if (file_exists($sitePath)) {
             array_unshift(self::$_modulePaths, $sitePath);
         }
     }
     return self::$_modulePaths;
 }