예제 #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());
 }
예제 #2
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());
 }
예제 #3
0
 public function testInvalidPage()
 {
     $app = new WebApplication(__DIR__ . "/app", "/testpage");
     $loops = $app->getLoops();
     $page = new InvalidPage($loops);
     $this->assertFalse($page->getPagePath());
 }
예제 #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);
 }
예제 #5
0
<?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);
}
예제 #6
0
<?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);
}