コード例 #1
0
 public function testPublicUrl()
 {
     $app = $this->getApp();
     $app->getTemplateEngine()->loadPlugin('smarty_function_theme_url');
     ob_start();
     $app->runControllerFromRawUrl('themes/testPublicUrl');
     $output = ob_get_clean();
     $this->assertEquals($app->config('baseUrl') . 'public/images/test.jpg', $output);
     ob_start();
     $app->runControllerFromRawUrl('themes/testPublicUrlArgs');
     $output = ob_get_clean();
     $this->assertEquals($app->config('baseUrl') . 'public/images/test.jpg?arg=arg1', $output);
     unsetRealpath();
 }
コード例 #2
0
 public function testGetLanguageByRunningController()
 {
     $app = $this->getApp();
     setRealpath();
     ob_start();
     $app->runControllerFromRawUrl('plugins/lang');
     $output = ob_get_clean();
     unsetRealpath();
     $file = 'vfs://root/public/default/App/languages/en/plugins/_pluginsLang.json';
     $this->assertTrue(file_exists($file));
     $json = file_get_contents($file);
     $this->assertFalse(empty($json));
     $json_r = json_decode($json, true);
     $this->assertEquals('app default en', $json_r['three']);
     $this->assertEquals('app default en', $output);
 }
コード例 #3
0
 /**
  * @expectedException \Skully\Exceptions\InvalidTemplateException
  * @expectedExceptionCode 99
  */
 public function testSmartyInvalidTemplateError()
 {
     $app = $this->getApp();
     $app->runControllerFromRawUrl('home/error');
     unsetRealpath();
 }