예제 #1
0
 public function testTemplateHelperReturnsTemplateObjectInstance()
 {
     $app = new Bullet\App(array('template.cfg' => array('path' => $this->templateDir)));
     $app->path('template-test', function ($request) use($app) {
         $app->get(function ($request) use($app) {
             return $app->template('test');
         });
     });
     $tpl = $app->run('GET', 'template-test');
     $this->assertInstanceOf('Bullet\\View\\Template', $tpl);
     $this->assertEquals('<p>Test</p>', $tpl->content());
 }
예제 #2
0
 function testGetWithQueryString()
 {
     $app = new Bullet\App();
     $app->path('test', function ($request) use($app) {
         $app->get(function ($request) {
             return 'foo=' . $request->foo;
         });
     });
     $req = new Bullet\Request('GET', '/test?foo=bar');
     $res = $app->run($req);
     $this->assertEquals('foo=bar', $res->content());
 }
예제 #3
0
파일: AppTest.php 프로젝트: netom/bulletphp
 public function testNestedRoutesInsideParamCallback()
 {
     $app = new Bullet\App();
     $app->path('admin', function ($request) use($app) {
         $app->path('client', function ($request) use($app) {
             $app->param('int', function ($request, $id) use($app) {
                 $app->path('toggleVisiblity', function ($request) use($app, $id) {
                     $app->path('item', function ($request) use($app, $id) {
                         $app->get(function ($request) use($app) {
                             return "deep";
                         });
                     });
                 });
             });
         });
     });
     $result = $app->run(new Bullet\Request('GET', '/admin/client/1/toggleVisiblity/item'));
     $this->assertEquals('deep', $result->content());
 }