|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Ivory CKEditor package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Eric GELOEN <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please read the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace FOS\CKEditorBundle\Tests\Template; |
|
13
|
|
|
|
|
14
|
|
|
use FOS\CKEditorBundle\Templating\CKEditorHelper; |
|
15
|
|
|
use Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper; |
|
16
|
|
|
use Symfony\Component\Templating\Helper\SlotsHelper; |
|
17
|
|
|
use Symfony\Component\Templating\Loader\FilesystemLoader; |
|
18
|
|
|
use Symfony\Component\Templating\PhpEngine; |
|
19
|
|
|
use Symfony\Component\Templating\TemplateNameParser; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @author GeLo <[email protected]> |
|
23
|
|
|
*/ |
|
24
|
|
|
class PhpTemplateTest extends AbstractTemplateTest |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* @var PhpEngine |
|
28
|
|
|
*/ |
|
29
|
|
|
private $phpEngine; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var FormHelper|\PHPUnit_Framework_MockObject_MockObject |
|
33
|
|
|
*/ |
|
34
|
|
|
private $formHelper; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var SlotsHelper|\PHPUnit_Framework_MockObject_MockObject |
|
38
|
|
|
*/ |
|
39
|
|
|
private $slotsHelper; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* {@inheritdoc} |
|
43
|
|
|
*/ |
|
44
|
|
|
protected function setUp() |
|
45
|
|
|
{ |
|
46
|
|
|
parent::setUp(); |
|
47
|
|
|
|
|
48
|
|
|
$this->formHelper = $this->getMockBuilder(FormHelper::class) |
|
49
|
|
|
->disableOriginalConstructor() |
|
50
|
|
|
->getMock(); |
|
51
|
|
|
|
|
52
|
|
|
$this->slotsHelper = $this->getMockBuilder(SlotsHelper::class) |
|
53
|
|
|
->disableOriginalConstructor() |
|
54
|
|
|
->getMock(); |
|
55
|
|
|
|
|
56
|
|
|
$this->phpEngine = new PhpEngine( |
|
57
|
|
|
new TemplateNameParser(), |
|
58
|
|
|
new FilesystemLoader([__DIR__.'/../../src/Resources/views/Form/%name%']), |
|
59
|
|
|
[ |
|
|
|
|
|
|
60
|
|
|
'form' => $this->formHelper, |
|
61
|
|
|
'slots' => $this->slotsHelper, |
|
62
|
|
|
new CKEditorHelper($this->renderer), |
|
63
|
|
|
] |
|
64
|
|
|
); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* {@inheritdoc} |
|
69
|
|
|
*/ |
|
70
|
|
|
protected function renderTemplate(array $context = []) |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->phpEngine->render('ckeditor_widget.html.php', $context); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: