Improve TemplateTest

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2017-03-19 18:00:24 -03:00
parent 5a4435a40d
commit 4bbe23f1df
4 changed files with 33 additions and 2 deletions

View File

@ -0,0 +1,2 @@
{{ variable1 }}
{{ variable2 }}

View File

@ -0,0 +1 @@
{{ variable -}}

View File

@ -0,0 +1 @@
static content

View File

@ -18,11 +18,13 @@ class TemplateTest extends PMATestCase
/**
* Test for set function
*
* @dataProvider providerTestSet
*
* @return void
*/
public function testSet()
public function testSet($data)
{
$template = PMA\libraries\Template::get('test/add_data');
$template = PMA\libraries\Template::get($data);
$template->set('variable1', 'value1');
$template->set(
array(
@ -34,6 +36,19 @@ class TemplateTest extends PMATestCase
$this->assertContains('value2', $result);
}
/**
* Data provider for testSet
*
* @return array
*/
public function providerTestSet()
{
return [
['test/add_data'],
['test/add_data_twig'],
];
}
/**
* Test for setHelper
*
@ -64,6 +79,10 @@ class TemplateTest extends PMATestCase
'static content',
PMA\libraries\Template::get('test/static')->render()
);
$this->assertEquals(
'static content',
PMA\libraries\Template::get('test/static_twig')->render()
);
}
/**
@ -81,5 +100,13 @@ class TemplateTest extends PMATestCase
)
)
);
$this->assertEquals(
'value',
PMA\libraries\Template::get('test/echo_twig')->render(
array(
'variable' => 'value'
)
)
);
}
}