public function testServe() { $routes = Erdiko::getRoutes(); $_SERVER['REQUEST_METHOD'] = 'get'; ob_start(); Toro::serve($routes); $out = ob_get_contents(); ob_end_clean(); //echo "Printing buffer............."; //var_dump($out); //Remove header $pos = strrpos($out, "</header>"); $out = substr($out, $pos + 9); //Remove footer $pos = strrpos($out, '<footer id="footer">'); $out = substr($out, 0, $pos); //var_dump($out); /* $header = file_get_contents($themeFolder.'/templates/page/header.php'); $pos = strrpos($header, 'navbar-brand'); $header = substr($header, 0, $pos); $find = strrpos($return, $header); $this->assertTrue($find != false); */ }
public function testGetRoutes() { //Get routes through getRoutes function $return = Erdiko::getRoutes(); //Get routes through direct access $filename = APPROOT . '/config/application/routes.json'; $data = str_replace("\\", "\\\\", file_get_contents($filename)); $json = json_decode($data, TRUE); //Validate data $this->assertEquals($return, $json['routes']); }
<?php /** * Index file * Intercepts all requests and dispatch routes * * @category Erdiko * @package Public * @copyright Copyright (c) 2016, Arroyo Labs, www.arroyolabs.com * @author John Arroyo */ // Bootstrap your app and erdiko include_once dirname(dirname(__DIR__)) . "/app/bootstrap.php"; try { $routes = Erdiko::getRoutes(getenv('ERDIKO_CONTEXT')); Toro::serve($routes); } catch (\Exception $e) { echo $e->getMessage(); // @todo return a 500 error & log error }
<?php /** * Index file * Intercepts all requests and dispatches routing * * @category Erdiko * @package Public * @copyright Copyright (c) 2014, Arroyo Labs, www.arroyolabs.com * @author John Arroyo */ include_once dirname(__DIR__) . "/bootstrap.php"; try { $routes = Erdiko::getRoutes(); Toro::serve($routes); } catch (\Exception $e) { echo $e->getMessage(); // @todo return a 500 error & log error }