It is responsible for loading an HTTP request, running the assigned services, and generating an HTTP response.
Example #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));
 }
Example #2
0
 function testMissingClass()
 {
     $test = null;
     $this->app->register('test', 'NonExistentClass');
     if (class_exists('NonExistentClass')) {
         $test = $this->app->test();
     }
     $this->assertEquals(null, $test);
 }
Example #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);
 }
Example #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);
 }
Example #5
0
 function testRenderLayout()
 {
     $this->app->render('hello', array('name' => 'Bob'), 'content');
     $this->app->render('layouts/layout');
     $this->expectOutputString('<html>Hello, Bob!</html>');
 }
Example #6
0
 function testHas()
 {
     $this->app->set('d', 1);
     $this->assertTrue($this->app->has('d'));
 }
Example #7
0
 function testStaticClassMethodMapping()
 {
     $this->app->map('map4', array('Hello', 'sayBye'));
     $result = $this->app->map4();
     $this->assertEquals('goodbye', $result);
 }
Example #8
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->set('app.settings.debug', false);
 }
Example #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>';
Example #10
0
 function testUnmapped()
 {
     $this->setExpectedException('Exception', 'doesNotExist must be a mapped method.');
     $this->app->doesNotExist();
 }