1
|
|
|
<?php |
2
|
|
|
namespace Redaxscript\Tests\View; |
3
|
|
|
|
4
|
|
|
use Redaxscript\Db; |
5
|
|
|
use Redaxscript\Tests\TestCaseAbstract; |
6
|
|
|
use Redaxscript\View; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* ExtraTest |
10
|
|
|
* |
11
|
|
|
* @since 4.2.0 |
12
|
|
|
* |
13
|
|
|
* @package Redaxscript |
14
|
|
|
* @category Tests |
15
|
|
|
* @author Henry Ruhs |
16
|
|
|
* |
17
|
|
|
* @covers Redaxscript\View\Extra |
18
|
|
|
* @covers Redaxscript\View\ViewAbstract |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
class ExtraTest extends TestCaseAbstract |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* setUp |
25
|
|
|
* |
26
|
|
|
* @since 4.2.0 |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
public function setUp() : void |
30
|
|
|
{ |
31
|
|
|
parent::setUp(); |
32
|
|
|
$installer = $this->installerFactory(); |
|
|
|
|
33
|
|
|
$installer->init(); |
34
|
|
|
$installer->rawCreate(); |
35
|
|
|
Db::forTablePrefix('extras') |
36
|
|
|
->create() |
37
|
|
|
->set( |
38
|
|
|
[ |
39
|
|
|
'title' => 'Extra One', |
40
|
|
|
'alias' => 'extra-one' |
41
|
|
|
]) |
42
|
|
|
->save(); |
43
|
|
|
Db::forTablePrefix('extras') |
44
|
|
|
->create() |
45
|
|
|
->set( |
46
|
|
|
[ |
47
|
|
|
'title' => 'Extra Two', |
48
|
|
|
'alias' => 'extra-two' |
49
|
|
|
]) |
50
|
|
|
->save(); |
51
|
|
|
Db::forTablePrefix('extras') |
52
|
|
|
->create() |
53
|
|
|
->set( |
54
|
|
|
[ |
55
|
|
|
'title' => 'Extra Three', |
56
|
|
|
'alias' => 'extra-three', |
57
|
|
|
'access' => '[1]' |
58
|
|
|
]) |
59
|
|
|
->save(); |
60
|
|
|
Db::forTablePrefix('extras') |
61
|
|
|
->create() |
62
|
|
|
->set( |
63
|
|
|
[ |
64
|
|
|
'title' => 'Extra Four', |
65
|
|
|
'alias' => 'extra-four', |
66
|
|
|
'category' => 1 |
67
|
|
|
]) |
68
|
|
|
->save(); |
69
|
|
|
Db::forTablePrefix('extras') |
70
|
|
|
->create() |
71
|
|
|
->set( |
72
|
|
|
[ |
73
|
|
|
'title' => 'Extra Five', |
74
|
|
|
'alias' => 'extra-five', |
75
|
|
|
'article' => 1 |
76
|
|
|
]) |
77
|
|
|
->save(); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* tearDown |
82
|
|
|
* |
83
|
|
|
* @since 4.2.0 |
84
|
|
|
*/ |
85
|
|
|
|
86
|
|
|
public function tearDown() : void |
87
|
|
|
{ |
88
|
|
|
$this->dropDatabase(); |
|
|
|
|
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* testRender |
93
|
|
|
* |
94
|
|
|
* @since 4.2.0 |
95
|
|
|
* |
96
|
|
|
* @param array $registryArray |
97
|
|
|
* @param array $optionArray |
98
|
|
|
* @param int $extraId |
99
|
|
|
* @param string $expect |
100
|
|
|
* |
101
|
|
|
* @dataProvider providerAutoloader |
102
|
|
|
*/ |
103
|
|
|
|
104
|
|
|
public function testRender(array $registryArray = [], array $optionArray = [], int $extraId = null, string $expect = null) : void |
105
|
|
|
{ |
106
|
|
|
/* setup */ |
107
|
|
|
|
108
|
|
|
$this->_registry->init($registryArray); |
109
|
|
|
$extra = new View\Extra($this->_registry, $this->_request, $this->_language, $this->_config); |
110
|
|
|
$extra->init($optionArray); |
111
|
|
|
|
112
|
|
|
/* actual */ |
113
|
|
|
|
114
|
|
|
$actual = $extra->render($extraId); |
115
|
|
|
|
116
|
|
|
/* compare */ |
117
|
|
|
|
118
|
|
|
$this->assertEquals($expect, $actual); |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.