Пример #1
0
 public function testFindDirectories_WhenModuleIsInstalledInSubdirectory()
 {
     $directoryStructure = array('www' => array('oxseo.php' => '', 'modules' => array('subdir' => array('testmodule' => array('tests' => array()))), 'vendor' => array('composer' => array('autoload_classmap.php' => ''))));
     $finder = new DirectoryFinder($this->setUpFilesystem($directoryStructure) . '/www/modules/subdir/testmodule/tests');
     $this->assertEquals("vfs://project/www", $finder->getShopBaseDir(), 'Expected shop-base-dir is not correct.');
     $this->assertEquals("vfs://project/www/modules/subdir/testmodule", $finder->getModuleDir(), 'Expected module-dir is not correct.');
     $this->assertEquals("vfs://project/www/modules/subdir/testmodule/tests", $finder->getTestDir(), 'Expected test-dir is not correct.');
     $this->assertEquals("vfs://project/www/vendor", $finder->getVendorDir(), 'Expected vendor-dir is not correct.');
 }
Пример #2
0
 /**
  * Bootstraps all files defined in metadata.php
  * of current module / or of all under modules
  */
 protected function registerModuleAutoloader()
 {
     if ($this->directoryFinder->isCallFromShopBaseDir()) {
         $pathToModules = $this->directoryFinder->getShopBaseDir() . '/modules';
         $metadataFiles = glob($pathToModules . '/*/metadata.php');
     } else {
         $metadataFiles = array($this->directoryFinder->getModuleDir() . '/metadata.php');
     }
     $autoloader = new ModuleAutoloader($metadataFiles);
     spl_autoload_register(array($autoloader, 'load'));
 }