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 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 testInvalidPage() { $app = new WebApplication(__DIR__ . "/app", "/testpage"); $loops = $app->getLoops(); $page = new InvalidPage($loops); $this->assertFalse($page->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); }
<?php /** * This file is part of the loops framework. * * @author Lukas <*****@*****.**> * @license https://raw.githubusercontent.com/loopsframework/base/master/LICENSE * @link https://github.com/loopsframework/base */ use Loops\Misc; use Loops\Application\WebApplication; try { $root_dir = realpath(__DIR__ . "/.."); require_once "{$root_dir}/vendor/autoload.php"; $url = $_GET["_url"]; unset($_GET["_url"]); $app = new WebApplication("{$root_dir}/app/", $url); $app->run(); } catch (Exception $e) { Misc::displayException($e); }
<?php /** * This file is part of the loops framework. * * @author Lukas <*****@*****.**> * @license https://raw.githubusercontent.com/loopsframework/base/master/LICENSE * @link https://github.com/loopsframework/base */ use Loops\Misc; use Loops\Application\WebApplication; try { $root_dir = realpath(__DIR__ . "/../.."); require_once "{$root_dir}/vendor/autoload.php"; $app = new WebApplication("{$root_dir}/app/"); $app->initialize($_GET["_url"], NULL, array_diff_key($_GET, array_flip(["_url"]))); $app->run(); } catch (Exception $e) { Misc::displayException($e); }