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()); }
public function testInvalidPage() { $app = new WebApplication(__DIR__ . "/app", "/testpage"); $loops = $app->getLoops(); $page = new InvalidPage($loops); $this->assertFalse($page->getPagePath()); }
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()); }
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); }