示例#1
0
 public function testGetMapsMap()
 {
     $sFixturePath = VSC_FIXTURE_PATH . 'config' . DIRECTORY_SEPARATOR;
     $o = new RwDispatcher();
     $o->loadSiteMap($sFixturePath . 'map.php');
     $this->assertInstanceOf(SiteMapA::class, $o->getSiteMap());
 }
 public function testBasicGetSitemap()
 {
     $o = new RwDispatcher();
     $o->loadSiteMap(VSC_FIXTURE_PATH . 'config/map.php');
     $map = $o->getCurrentProcessorMap();
     $this->assertInstanceOf(MappingA::class, $map);
     $this->assertInstanceOf(ClassMap::class, $map);
 }
 public function testGetProcessorController()
 {
     $sFixturePath = VSC_FIXTURE_PATH . 'config' . DIRECTORY_SEPARATOR;
     $o = new RwDispatcher();
     $o->loadSiteMap($sFixturePath . 'map.php');
     $oRequest = new PopulatedRequest();
     vsc::getEnv()->setHttpRequest($oRequest);
     $this->assertInstanceOf(ProcessorFixture::class, $o->getProcessController());
 }
示例#4
0
 public function testTemplatePath()
 {
     $sFixturePath = VSC_FIXTURE_PATH . 'config' . DIRECTORY_SEPARATOR;
     $o = new RwDispatcher();
     $o->loadSiteMap($sFixturePath . 'map.php');
     $oRequest = new PopulatedRequest();
     vsc::getEnv()->setHttpRequest($oRequest);
     $genericTemplatePath = VSC_FIXTURE_PATH . 'templates' . DIRECTORY_SEPARATOR;
     $this->assertEquals($genericTemplatePath, $o->getTemplatePath());
 }
示例#5
0
 public function testLoadSiteMap()
 {
     $Exception = new ExceptionError('test', 123);
     $o = new ErrorProcessor($Exception);
     $oMap = new ClassMap(ErrorProcessor::class, '.*');
     $o->setMap($oMap);
     $sFixturePath = VSC_FIXTURE_PATH . 'config' . DIRECTORY_SEPARATOR;
     $o = new RwDispatcher();
     $o->loadSiteMap($sFixturePath . 'map.php');
     $this->assertInstanceOf(SiteMapA::class, $o->getSiteMap());
 }
示例#6
0
 public function testParentModuleMap()
 {
     vsc::getEnv()->getHttpRequest()->setUri('/');
     $o = new RwDispatcher();
     $this->assertTrue($o->loadSiteMap(VSC_RES_PATH . 'config/map.php'));
     $moduleMap = $o->getCurrentModuleMap();
     $this->assertInstanceOf(MappingA::class, $moduleMap);
     $this->assertInstanceOf(ModuleMap::class, $moduleMap);
     $this->assertEquals(VSC_RES_PATH . 'templates' . DIRECTORY_SEPARATOR, $moduleMap->getTemplatePath());
     $this->assertEquals(VSC_RES_PATH . 'templates' . DIRECTORY_SEPARATOR, $moduleMap->getMainTemplatePath());
     $this->assertEquals('main.php', $moduleMap->getMainTemplate());
 }
 public function testBasicGetFrontController()
 {
     $sFixturePath = VSC_FIXTURE_PATH . 'config' . DIRECTORY_SEPARATOR;
     $o = new RwDispatcher();
     $this->assertTrue(is_file($sFixturePath . 'map.php'));
     $this->assertTrue($o->loadSiteMap($sFixturePath . 'map.php'));
     $oRequest = new PopulatedRequest();
     vsc::getEnv()->setHttpRequest($oRequest);
     try {
         $oFront = $o->getFrontController();
         $this->assertInstanceOf(FrontControllerA::class, $oFront);
     } catch (\Exception $e) {
         $this->assertInstanceOf(ExceptionResponseError::class, $e);
     }
 }