blob: fd909cb1c95747b63ce579f5ae1fc3fc3ac891be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?php
use Flexi\Factory;
final class PhpTemplatePartialBugTestCase extends Codeception\Test\Unit
{
private Factory $factory;
public function setUp(): void
{
$this->setUpFS();
$this->factory = new Factory('var://templates/');
}
public function tearDown(): void
{
unset($this->factory);
stream_wrapper_unregister("var");
}
public function setUpFS(): void
{
ArrayFileStream::set_filesystem([
'templates' => [
'layout.php' =>
'<? $do_not_echo_this = $this->render_partial_collection("partial", range(1, 5));' .
'echo $content_for_layout;',
'partial.php' =>
'partial',
'template.php' =>
'template',
]
]);
if (!stream_wrapper_register('var', ArrayFileStream::class)) {
die('Failed to register protocol');
}
}
public function testPartialBug()
{
$template = $this->factory->open('template');
$template->set_layout('layout');
$result = $template->render();
$this->assertEquals($result, "template");
}
}
|