Inheritance: extends PHPUnit_Framework_TestCase
 protected function setUp()
 {
     parent::setUp();
     \Myfox\Lib\Mysql::register('default', __DIR__ . '/ini/mysql.ini');
     self::$mysql = \Myfox\Lib\Mysql::instance('default');
     self::$mysql->query(sprintf("DELETE FROM %stable_list WHERE table_name = 'i am not exists'", self::$mysql->option('prefix')));
     self::$mysql->query(sprintf("DELETE FROM %ssettings WHERE cfgname IN ('table_route_count', 'table_real_count')", self::$mysql->option('prefix')));
     self::cleanTable('default', 'route_info');
     Setting::set('last_assign_host', 0);
 }
Example #2
0
        $route = $r->find_route('a/b/?personnumber=156');
        $this->assertEquals(':controller/:action/:id', $route['path']);
        $this->assertEquals(array('default route'), $route['params']);
    }
    /**
     * Test route table with route with empty path
     */
    public function testEmpty_route()
    {
        $r = new Router();
        //  Build route table with only an empty path
        $r->connect('', array('empty route'));
        $route = $r->find_route('');
        $this->assertEquals('', $route['path']);
        $this->assertEquals(array('empty route'), $route['params']);
        //  This route shouldn't match anything
        $route = $r->find_route('mumble/foo');
        $this->assertNull($route);
    }
}
// Call RouterTest::main() if this source file is executed directly.
if (PHPUnit2_MAIN_METHOD == "RouterTest::main") {
    RouterTest::main();
}
// -- set Emacs parameters --
// Local variables:
// tab-width: 4
// c-basic-offset: 4
// c-hanging-comment-ender-p: nil
// indent-tabs-mode: nil
// End:
Example #3
0
 public static function setUpBeforeClass()
 {
     self::$theme = new Theme();
     self::$theme->load('test');
 }
Example #4
0
 public function setUp()
 {
     parent::setUp();
     self::$theme = Theme::load('test');
 }
Example #5
0
 function header($string, $replace = true, $http_response_code = 200)
 {
     global $header;
     if (!$replace && isset($header)) {
         return;
     }
     $header[$string] = $string;
     $h = $string;
     $s = debug_backtrace(true);
     $rt = function ($a) {
         return isset($a['object']) && $a['object'] instanceof RouterTest;
     };
     if (array_filter($s, $rt) && 0 === strpos($h, 'HTTP/1.1 ')) {
         RouterTest::$status = substr($h, 9);
     }
     return @\header($h);
 }
Example #6
0
 public static function setUpBeforeClass()
 {
     self::$theme = Theme::load('test');
 }