Completed
Push — master ( 0e2bb1...d48330 )
by WEBEWEB
02:01
created

ThemeManagerTest::testAddGlobal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 9.1563
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\CoreBundle\Tests\Manager;
13
14
use Exception;
15
use WBW\Bundle\CoreBundle\Manager\ThemeManager;
16
use WBW\Bundle\CoreBundle\Provider\Theme\ApplicationThemeProviderInterface;
17
use WBW\Bundle\CoreBundle\Provider\Theme\BreadcrumbsThemeProviderInterface;
18
use WBW\Bundle\CoreBundle\Provider\Theme\FooterThemeProviderInterface;
19
use WBW\Bundle\CoreBundle\Provider\Theme\HookDropDownThemeProviderInterface;
20
use WBW\Bundle\CoreBundle\Provider\Theme\NavigationThemeProviderInterface;
21
use WBW\Bundle\CoreBundle\Provider\Theme\NotificationsDropDownThemeProviderInterface;
22
use WBW\Bundle\CoreBundle\Provider\Theme\SearchThemeProviderInterface;
23
use WBW\Bundle\CoreBundle\Provider\Theme\TasksDropDownThemeProviderInterface;
24
use WBW\Bundle\CoreBundle\Provider\Theme\UserInfoThemeProviderInterface;
25
use WBW\Bundle\CoreBundle\Tests\AbstractTestCase;
26
27
/**
28
 * Theme manager test.
29
 *
30
 * @author webeweb <https://github.com/webeweb/>
31
 * @package WBW\Bundle\CoreBundle\Tests\Manager
32
 */
33
class ThemeManagerTest extends AbstractTestCase {
34
35
    /**
36
     * Tests the addGlobal() method.
37
     *
38
     * @return void
39
     * @throws Exception Throws an exception if an error occurs.
40
     */
41
    public function testAddGlobal(): void {
42
43
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
44
45
        // Set the Theme provider mocks.
46
        $obj->setApplicationThemeProvider($this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
47
        $obj->setBreadcrumbsThemeProvider($this->getMockBuilder(BreadcrumbsThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
48
        $obj->setHookDropDownThemeProvider($this->getMockBuilder(HookDropDownThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
49
        $obj->setFooterThemeProvider($this->getMockBuilder(FooterThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
50
        $obj->setNavigationThemeProvider($this->getMockBuilder(NavigationThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
51
        $obj->setNotificationsDropDownThemeProvider($this->getMockBuilder(NotificationsDropDownThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
52
        $obj->setSearchThemeProvider($this->getMockBuilder(SearchThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
53
        $obj->setTasksDropDownThemeProvider($this->getMockBuilder(TasksDropDownThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
54
        $obj->setUserInfoThemeProvider($this->getMockBuilder(UserInfoThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
55
56
        $obj->addGlobal();
57
58
        $res = $this->twigEnvironment->getGlobals();
59
        $this->assertCount(9, $res);
0 ignored issues
show
Documentation introduced by
$res is of type array, but the function expects a object<Countable>|object...nit\Framework\iterable>.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
60
61
        $this->assertArrayHasKey("ApplicationThemeProvider", $res);
62
        $this->assertInstanceOf(ApplicationThemeProviderInterface::class, $res["ApplicationThemeProvider"]);
63
64
        $this->assertArrayHasKey("BreadcrumbsThemeProvider", $res);
65
        $this->assertInstanceOf(BreadcrumbsThemeProviderInterface::class, $res["BreadcrumbsThemeProvider"]);
66
67
        $this->assertArrayHasKey("FooterThemeProvider", $res);
68
        $this->assertInstanceOf(FooterThemeProviderInterface::class, $res["FooterThemeProvider"]);
69
70
        $this->assertArrayHasKey("HookDropDownThemeProvider", $res);
71
        $this->assertInstanceOf(HookDropDownThemeProviderInterface::class, $res["HookDropDownThemeProvider"]);
72
73
        $this->assertArrayHasKey("NavigationThemeProvider", $res);
74
        $this->assertInstanceOf(NavigationThemeProviderInterface::class, $res["NavigationThemeProvider"]);
75
76
        $this->assertArrayHasKey("NotificationsDropDownThemeProvider", $res);
77
        $this->assertInstanceOf(NotificationsDropDownThemeProviderInterface::class, $res["NotificationsDropDownThemeProvider"]);
78
79
        $this->assertArrayHasKey("TasksDropDownThemeProvider", $res);
80
        $this->assertInstanceOf(TasksDropDownThemeProviderInterface::class, $res["TasksDropDownThemeProvider"]);
81
82
        $this->assertArrayHasKey("SearchThemeProvider", $res);
83
        $this->assertInstanceOf(SearchThemeProviderInterface::class, $res["SearchThemeProvider"]);
84
85
        $this->assertArrayHasKey("UserInfoThemeProvider", $res);
86
        $this->assertInstanceOf(UserInfoThemeProviderInterface::class, $res["UserInfoThemeProvider"]);
87
    }
88
89
    /**
90
     * Tests the hasProviders() method.
91
     *
92
     * @return void
93
     * @throws Exception Throws an exception if an error occurs.
94
     */
95
    public function testHasProviders(): void {
96
97
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
98
99
        $this->assertFalse($obj->hasProviders());
100
101
        $obj->setApplicationThemeProvider($this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
102
        $this->assertTrue($obj->hasProviders());
103
    }
104
105
    /**
106
     * Tests the setApplicationThemeProvider() method.
107
     *
108
     * @return void
109
     * @throws Exception Throws an exception if an error occurs.
110
     */
111
    public function testSetApplicationThemeProvider(): void {
112
113
        // Set a Application theme provider mock.
114
        $provider = $this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock();
115
116
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
117
118
        $obj->setApplicationThemeProvider($this->getMockBuilder(ApplicationThemeProviderInterface::class)->getMock());
0 ignored issues
show
Documentation introduced by
$this->getMockBuilder(\W...face::class)->getMock() is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
119
        $this->assertNotSame($provider, $obj->getApplicationThemeProvider());
120
121
        $obj->setApplicationThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
122
        $this->assertSame($provider, $obj->getApplicationThemeProvider());
123
    }
124
125
    /**
126
     * Tests the setBreadcrumbsThemeProvider() method.
127
     *
128
     * @return void
129
     * @throws Exception Throws an exception if an error occurs.
130
     */
131
    public function testSetBreadcrumbsThemeProvider(): void {
132
133
        // Set a Breadcrumbs theme provider mock.
134
        $provider = $this->getMockBuilder(BreadcrumbsThemeProviderInterface::class)->getMock();
135
136
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
137
138
        $obj->setBreadcrumbsThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
139
        $this->assertSame($provider, $obj->getBreadcrumbsThemeProvider());
140
    }
141
142
    /**
143
     * Tests the setFooterThemeProvider() method.
144
     *
145
     * @return void
146
     * @throws Exception Throws an exception if an error occurs.
147
     */
148
    public function testSetFooterThemeProvider(): void {
149
150
        // Set a Footer theme provider mock.
151
        $provider = $this->getMockBuilder(FooterThemeProviderInterface::class)->getMock();
152
153
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
154
155
        $obj->setFooterThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
156
        $this->assertSame($provider, $obj->getFooterThemeProvider());
157
    }
158
159
    /**
160
     * Tests the setHookDropDownThemeProvider() method.
161
     *
162
     * @return void
163
     * @throws Exception Throws an exception if an error occurs.
164
     */
165
    public function testSetHookDropDownThemeProvider(): void {
166
167
        // Set a Hook drop down theme provider mock.
168
        $provider = $this->getMockBuilder(HookDropDownThemeProviderInterface::class)->getMock();
169
170
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
171
172
        $obj->setHookDropDownThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
173
        $this->assertSame($provider, $obj->getHookDropDownThemeProvider());
174
    }
175
176
    /**
177
     * Tests the setNavigationThemeProvider() method.
178
     *
179
     * @return void
180
     * @throws Exception Throws an exception if an error occurs.
181
     */
182
    public function testSetNavigationThemeProvider(): void {
183
184
        // Set a Navigation theme provider mock.
185
        $provider = $this->getMockBuilder(NavigationThemeProviderInterface::class)->getMock();
186
187
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
188
189
        $obj->setNavigationThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
190
        $this->assertSame($provider, $obj->getNavigationThemeProvider());
191
    }
192
193
    /**
194
     * Tests the setNotificationsDropDownThemeProvider() method.
195
     *
196
     * @return void
197
     * @throws Exception Throws an exception if an error occurs.
198
     */
199
    public function testSetNotificationsDropDownThemeProvider(): void {
200
201
        // Set a Notifications drop down theme provider mock.
202
        $provider = $this->getMockBuilder(NotificationsDropDownThemeProviderInterface::class)->getMock();
203
204
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
205
206
        $obj->setNotificationsDropDownThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
207
        $this->assertSame($provider, $obj->getNotificationsDropDownThemeProvider());
208
    }
209
210
    /**
211
     * Tests the setSearchThemeProvider() method.
212
     *
213
     * @return void
214
     * @throws Exception Throws an exception if an error occurs.
215
     */
216
    public function testSetSearchThemeProvider(): void {
217
218
        // Set a Search theme provider mock.
219
        $provider = $this->getMockBuilder(SearchThemeProviderInterface::class)->getMock();
220
221
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
222
223
        $obj->setSearchThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
224
        $this->assertSame($provider, $obj->getSearchThemeProvider());
225
    }
226
227
    /**
228
     * Tests the setTasksDropDownThemeProvider() method.
229
     *
230
     * @return void
231
     * @throws Exception Throws an exception if an error occurs.
232
     */
233
    public function testSetTasksDropDownThemeProvider(): void {
234
235
        // Set a Tasks drop down theme provider mock.
236
        $provider = $this->getMockBuilder(TasksDropDownThemeProviderInterface::class)->getMock();
237
238
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
239
240
        $obj->setTasksDropDownThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
241
        $this->assertSame($provider, $obj->getTasksDropDownThemeProvider());
242
    }
243
244
    /**
245
     * Tests the setUserInfoThemeProvider() method.
246
     *
247
     * @return void
248
     * @throws Exception Throws an exception if an error occurs.
249
     */
250
    public function testSetUserInfoThemeProvider(): void {
251
252
        // Set the mocks.
253
        $provider = $this->getMockBuilder(UserInfoThemeProviderInterface::class)->getMock();
254
255
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
256
257
        $obj->setUserInfoThemeProvider($provider);
0 ignored issues
show
Documentation introduced by
$provider is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<WBW\Bundle\CoreBu...ProviderInterface>|null.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
258
        $this->assertSame($provider, $obj->getUserInfoThemeProvider());
259
    }
260
261
    /**
262
     * Tests the __construct() method.
263
     *
264
     * @return void
265
     * @throws Exception Throws an exception if an error occurs.
266
     */
267
    public function test__construct(): void {
268
269
        $this->assertEquals("wbw.core.manager.theme", ThemeManager::SERVICE_NAME);
270
271
        $obj = new ThemeManager($this->logger, $this->twigEnvironment);
272
273
        $this->assertNull($obj->getApplicationThemeProvider());
274
        $this->assertNull($obj->getBreadcrumbsThemeProvider());
275
        $this->assertNull($obj->getFooterThemeProvider());
276
        $this->assertNull($obj->getHookDropDownThemeProvider());
277
        $this->assertNull($obj->getNavigationThemeProvider());
278
        $this->assertNull($obj->getNotificationsDropDownThemeProvider());
279
        $this->assertNull($obj->getSearchThemeProvider());
280
        $this->assertNull($obj->getTasksDropDownThemeProvider());
281
        $this->assertNull($obj->getUserInfoThemeProvider());
282
    }
283
}
284