It is responsible for loading an HTTP request, running the assigned services, and generating an HTTP response.
Ejemplo n.º 1
1
 function testBaseOverride()
 {
     $url = 'login';
     if ($this->app->get('flight.base_url') !== null) {
         $base = $this->app->get('flight.base_url');
     } else {
         $base = $this->app->request()->base;
     }
     $this->assertEquals('/testdir/login', $this->getBaseUrl($base, $url));
 }
Ejemplo n.º 2
0
 function testMissingClass()
 {
     $test = null;
     $this->app->register('test', 'NonExistentClass');
     if (class_exists('NonExistentClass')) {
         $test = $this->app->test();
     }
     $this->assertEquals(null, $test);
 }
Ejemplo n.º 3
0
 function testMapOverridesRegister()
 {
     $this->app->register('reg5', 'User');
     $user = $this->app->reg5();
     $this->assertTrue(is_object($user));
     $this->app->map('reg5', function () {
         return 123;
     });
     $user = $this->app->reg5();
     $this->assertEquals(123, $user);
 }
Ejemplo n.º 4
0
 function testFilterChaining()
 {
     $this->app->map('bye', function ($name) {
         return "Bye, {$name}!";
     });
     $this->app->before('bye', function (&$params, &$output) {
         $params[0] = 'Bob';
     });
     $this->app->before('bye', function (&$params, &$output) {
         $params[0] = 'Fred';
         return false;
     });
     $this->app->before('bye', function (&$params, &$output) {
         $params[0] = 'Ted';
     });
     $result = $this->app->bye('Joe');
     $this->assertEquals('Bye, Fred!', $result);
 }
Ejemplo n.º 5
0
 function testRenderLayout()
 {
     $this->app->render('hello', array('name' => 'Bob'), 'content');
     $this->app->render('layouts/layout');
     $this->expectOutputString('<html>Hello, Bob!</html>');
 }
Ejemplo n.º 6
0
 function testHas()
 {
     $this->app->set('d', 1);
     $this->assertTrue($this->app->has('d'));
 }
Ejemplo n.º 7
0
 function testStaticClassMethodMapping()
 {
     $this->app->map('map4', array('Hello', 'sayBye'));
     $result = $this->app->map4();
     $this->assertEquals('goodbye', $result);
 }
Ejemplo n.º 8
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->set('app.settings.debug', false);
 }
Ejemplo n.º 9
0
    $conn->ConnectClose($link);
    $str = '<h2>資料來源:<a href="https://www.facebook.com/BeautyNTTU/?fref=ts" target="_blank">表特東大</a></h2>
				<p>僅提供瀏覽,欣賞</p>';
    $len = count($data);
    for ($index = 0; $index < $len; $index++) {
        $message = $data[$index]["message"];
        $normal = "https://graph.facebook.com/" . $data[$index]["obj_id"] . "/picture?type=normal";
        $thumbnail = "https://graph.facebook.com/" . $data[$index]["obj_id"] . "/picture?type=thumbnail";
        $str .= '<a title="' . $message . '" class="swipebox" href="' . $normal . '">';
        $str .= '<img src="' . $thumbnail . '" alt="image" class="img-rounded">';
        $str .= '</a>';
    }
    return $str;
}
use flight\Engine;
$app = new Engine();
$app->route('GET /', function () {
    $str = RequsetData("正妹");
    $MaleFemale = '<li>
			<a href="/beauty-nttu/man">型男版</a>
        </li>';
    Flight::render('index_view.php', array('data' => $str, 'MaleFemale' => $MaleFemale));
});
$app->route('GET /@action', function ($action) {
    $str = "";
    $MaleFemale = '<li>
			<a href="/beauty-nttu/man">型男版</a>
        </li>
		<li>
            <a href="/beauty-nttu/">正妹版</a>
        </li>';
Ejemplo n.º 10
0
 function testUnmapped()
 {
     $this->setExpectedException('Exception', 'doesNotExist must be a mapped method.');
     $this->app->doesNotExist();
 }