Exemplo n.º 1
0
 function testPath()
 {
     $app = new WebApplication(__DIR__ . "/app", "/");
     ob_start();
     $app->run();
     ob_end_clean();
     $errorpage = new ErrorPage(404, $app->getLoops());
     $this->assertEquals("", $errorpage->getPagePath());
     $app = new WebApplication(__DIR__ . "/app", "/test");
     ob_start();
     $app->run();
     ob_end_clean();
     $errorpage = new ErrorPage(404, $app->getLoops());
     $this->assertEquals("test", $errorpage->getPagePath());
     $app = new WebApplication(__DIR__ . "/app", "/test/longerurl");
     ob_start();
     $app->run();
     ob_end_clean();
     $errorpage = new ErrorPage(404, $app->getLoops());
     $this->assertEquals("test/longerurl", $errorpage->getPagePath());
 }
Exemplo n.º 2
0
 public function testInvalidPage()
 {
     $app = new WebApplication(__DIR__ . "/app", "/testpage");
     $loops = $app->getLoops();
     $page = new InvalidPage($loops);
     $this->assertFalse($page->getPagePath());
 }
Exemplo n.º 3
0
 public function testLoopsGetPagePathIndexDelegate()
 {
     $app = new WebApplication(__DIR__ . "/app", "/", "GET", [], [], [], [], [], FALSE);
     $loops = $app->getLoops();
     $page = new IndexDelegate(["a"]);
     $element = new DefaultElement();
     $page->offsetSet("test", $element);
     $this->assertSame("a/deeperdelegate/", $element->getPagePath());
 }
Exemplo n.º 4
0
 public function testGetServiceDifferentClassAndParams()
 {
     $app = new WebApplication(__DIR__ . "/app", "/");
     $loops = $app->getLoops();
     $service = Loops\Service\DifferentClassnameService::getService(new ArrayObject(), $loops);
     $this->assertInstanceOf("DummyClass", $service);
     $service = Loops\Service\DifferentClassnameService::getService(new ArrayObject(["param1" => "test"]), $loops);
     $this->assertInstanceOf("DummyClass", $service);
     $this->assertSame("test", $service->param1);
 }