Exemplo n.º 1
0
 /**
  * @runInSeparateProcess
  */
 function testIgnoringPrefix()
 {
     $app = new \Framework\Initializer();
     \Framework\Application::$url_prefix = '/test/';
     ob_start();
     $app->run('/test/test1', 'GET');
     $result = ob_get_clean();
     $this->assertEquals('OK!', $result);
 }
Exemplo n.º 2
0
<?php

require 'vendor/autoload.php';
$con = new PDO("sqlite:db/database.sqlite3");
TORM\Connection::setConnection($con);
TORM\Connection::setDriver("sqlite");
$app = new \Framework\Initializer();
if (getenv('BIRDS_ENV') == 'development') {
    $app->public_folder = dirname(__FILE__) . '/public/';
} else {
    \Framework\Application::$url_prefix = '/projetos/gaia-pdti/index.php';
    if ($_SERVER['REQUEST_URI'] == '/projetos/gaia-pdti/') {
        header('Location: ' . \Framework\Application::$url_prefix);
    }
}
$app->run($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
Exemplo n.º 3
0
<?php

\Framework\Application::$url_prefix = '/pre/';
class Model extends \TORM\Model
{
}
class HelperTest extends \PHPUnit_Framework_TestCase
{
    function testURL()
    {
        $this->assertEquals('/pre/aaa', url('/aaa'));
        $this->assertEquals('/pre/photos/1', url('/photos/:id', [1]));
        $this->assertEquals('/pre/photos/1/comment/2', url('/photos/:id/comment/:comment_id', [1, 2]));
        $this->assertEquals('/pre/photos/1', url('/photos/:id', ['id' => 1]));
        $this->assertEquals('/pre/photos/1/comment/2', url('/photos/:id/comment/:comment_id', ['id' => 1, 'comment_id' => 2]));
    }
    function testLinkTo()
    {
        $this->assertEquals('<a href="/pre/">Text</a>', link_to('/', 'Text'));
        $model = new Model();
        $model->id = 2;
        $this->assertEquals('<a href="/pre/models/2">Text 2</a>', link_to($model, 'Text 2'));
        $this->assertEquals('<a href="/pre/models/2" class="btn" id="aa">Text 2</a>', link_to($model, 'Text 2', ['class' => 'btn', 'id' => 'aa']));
    }
}