Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauriciofauth@gmail.com>2018-06-05 07:08:08 +0300
committerMaurício Meneghini Fauth <mauriciofauth@gmail.com>2018-06-05 07:08:08 +0300
commit628d27b69ae4db61e0437cc97b5f18c85c79443a (patch)
tree13a512e305d698cc5067698be5aaafcb8ddf1d38 /test
parent010a72dc00b56fc26bb7d57718b63f82904ed800 (diff)
Refactor Template class
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/classes/TemplateTest.php32
1 files changed, 21 insertions, 11 deletions
diff --git a/test/classes/TemplateTest.php b/test/classes/TemplateTest.php
index f63402ff78..cfabd9d67a 100644
--- a/test/classes/TemplateTest.php
+++ b/test/classes/TemplateTest.php
@@ -21,6 +21,19 @@ use Twig\Error\LoaderError;
class TemplateTest extends PmaTestCase
{
/**
+ * @var Template
+ */
+ protected $template;
+
+ /**
+ * Sets up the fixture.
+ */
+ protected function setUp()
+ {
+ $this->template = new Template();
+ }
+
+ /**
* Test for set function
*
* @param string $data Template name
@@ -31,13 +44,10 @@ class TemplateTest extends PmaTestCase
*/
public function testSet($data)
{
- $template = Template::get($data);
- $result = $template->render(
- [
- 'variable1' => 'value1',
- 'variable2' => 'value2',
- ]
- );
+ $result = $this->template->render($data, [
+ 'variable1' => 'value1',
+ 'variable2' => 'value2',
+ ]);
$this->assertContains('value1', $result);
$this->assertContains('value2', $result);
}
@@ -69,7 +79,7 @@ class TemplateTest extends PmaTestCase
{
$this->assertEquals(
$value,
- Template::get($templateFile)->render([$key => $value])
+ $this->template->render($templateFile, [$key => $value])
);
}
@@ -93,7 +103,7 @@ class TemplateTest extends PmaTestCase
public function testRenderTemplateNotFound()
{
$this->expectException(LoaderError::class);
- Template::get('template not found')->render();
+ $this->template->render('template not found');
}
/**
@@ -110,7 +120,7 @@ class TemplateTest extends PmaTestCase
{
$this->assertEquals(
$expectedResult,
- Template::get($templateFile)->render()
+ $this->template->render($templateFile)
);
}
@@ -141,7 +151,7 @@ class TemplateTest extends PmaTestCase
{
$this->assertEquals(
$expectedResult,
- Template::get($templateFile)->render($renderParams)
+ $this->template->render($templateFile, $renderParams)
);
}