mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-21 20:34:57 +09:00
Finish 4.13.2
This commit is contained in:
commit
349cc38ea9
3 files changed
+30
-6
No files matched your search
@@ -71,7 +71,7 @@ class Payment_Adapter_Custom
|
||||
'_tpl' => ($subscription) ? $this->config['recurrent'] : $this->config['single'],
|
||||
);
|
||||
$systemService = $this->di['mod_service']('System');
|
||||
return $systemService->renderString($vars['_tpl'], false, $vars);
|
||||
return $systemService->renderString($vars['_tpl'], true, $vars);
|
||||
}
|
||||
|
||||
public function process($tx)
|
||||
|
||||
@@ -313,11 +313,7 @@ class Service
|
||||
$parsed = $template->render($vars);
|
||||
} catch (\Exception $e) {
|
||||
$parsed = $tpl;
|
||||
if ($e instanceof \Twig_Error_Syntax || $e instanceof \Twig_Error_Loader) {
|
||||
if (!$try_render) {
|
||||
throw $e;
|
||||
}
|
||||
} else {
|
||||
if (!$try_render) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,6 +282,34 @@ class ServiceTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->service->renderString('test', false, $vars);
|
||||
}
|
||||
|
||||
public function testrenderStringTemplate()
|
||||
{
|
||||
$vars = array(
|
||||
'_client_id' => 1
|
||||
);
|
||||
|
||||
$twigMock = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$twigMock->expects($this->atLeastOnce())
|
||||
->method('addGlobal');
|
||||
$twigMock->expects($this->atLeastOnce())
|
||||
->method('loadTemplate')
|
||||
->willThrowException(new \Twig_Error_Syntax('Exception created with PHPUNIT'));
|
||||
|
||||
$dbMock = $this->getMockBuilder('\Box_Database')->getMock();
|
||||
$dbMock->expects($this->atLeastOnce())
|
||||
->method('load')
|
||||
->will($this->returnValue(new \Model_Client()));
|
||||
|
||||
$di = new \Box_Di();
|
||||
$di['db'] = $dbMock;
|
||||
$di['twig'] = $twigMock;
|
||||
$di['api_client'] = new \Model_Client();
|
||||
$this->service->setDi($di);
|
||||
|
||||
$string = $this->service->renderString('test', true, $vars);
|
||||
$this->assertEquals($string, 'test');
|
||||
}
|
||||
|
||||
public function testclearCache()
|
||||
{
|
||||
$toolsMock = $this->getMockBuilder('\Box_Tools')->getMock();
|
||||
|
||||
Reference in new issue
Block a user