protected function getApp()
 {
     $structure = $this->appStructure();
     $this->root = vfsStream::setup('root', 777, $structure);
     $config = new Config();
     $config->setProtectedFromArray(array('theme' => 'test', 'basePath' => vfsStream::url('root'), 'baseUrl' => 'http://localhost/skully/', 'languages' => array('en' => array('value' => 'english', 'code' => 'en')), 'urlRules' => array('' => 'home/index', 'admin' => 'admin/home/index'), 'namespace' => 'App', 'caching' => 0));
     setRealpath();
     return new \App\Application($config);
 }
 protected function getApp()
 {
     $structure = $this->getStructure();
     $this->root = vfsStream::setup('root', 777, $structure);
     $config = new Config();
     $config->setProtectedFromArray(array('theme' => 'test', 'language' => 'en', 'languages' => array('en' => array('value' => 'english', 'code' => 'en')), 'basePath' => vfsStream::url('root'), 'skullyBasePath' => vfsStream::url('root/vendor/triodigital/skully/'), 'baseUrl' => 'http://localhost/skully/', 'urlRules' => array('' => 'home/index', 'admin' => 'admin/home/index')));
     $_SESSION['language'] = 'id';
     setRealPath();
     $app = new \App\Application($config);
     unsetRealpath();
     $pluginsPath = realpath(__DIR__ . '/../../App/smarty/plugins');
     setRealpath();
     $app->getTemplateEngine()->addPluginsDir($pluginsPath);
     return $app;
 }
 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);
 }