|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yiisoft\Yii\Widgets\Tests\Menu; |
|
6
|
|
|
|
|
7
|
|
|
use PHPUnit\Framework\TestCase; |
|
8
|
|
|
use Yiisoft\Definitions\Exception\CircularReferenceException; |
|
9
|
|
|
use Yiisoft\Definitions\Exception\InvalidConfigException; |
|
10
|
|
|
use Yiisoft\Definitions\Exception\NotInstantiableException; |
|
11
|
|
|
use Yiisoft\Factory\NotFoundException; |
|
12
|
|
|
use Yiisoft\Yii\Widgets\Menu; |
|
13
|
|
|
use Yiisoft\Yii\Widgets\Tests\Support\TestTrait; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @psalm-suppress PropertyNotSetInConstructor |
|
17
|
|
|
*/ |
|
18
|
|
|
final class ImmutableTest extends TestCase |
|
19
|
|
|
{ |
|
20
|
|
|
use TestTrait; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @throws CircularReferenceException |
|
24
|
|
|
* @throws InvalidConfigException |
|
25
|
|
|
* @throws NotFoundException |
|
26
|
|
|
* @throws NotInstantiableException |
|
27
|
|
|
*/ |
|
28
|
|
|
public function testImmutable(): void |
|
29
|
|
|
{ |
|
30
|
|
|
$menu = Menu::widget(); |
|
31
|
|
|
$this->assertNotSame($menu, $menu->afterAttributes([])); |
|
|
|
|
|
|
32
|
|
|
$this->assertNotSame($menu, $menu->afterClass('')); |
|
|
|
|
|
|
33
|
|
|
$this->assertNotSame($menu, $menu->afterContent('')); |
|
|
|
|
|
|
34
|
|
|
$this->assertNotSame($menu, $menu->afterTag('')); |
|
|
|
|
|
|
35
|
|
|
$this->assertNotSame($menu, $menu->activeClass('')); |
|
|
|
|
|
|
36
|
|
|
$this->assertNotSame($menu, $menu->attributes([])); |
|
|
|
|
|
|
37
|
|
|
$this->assertNotSame($menu, $menu->beforeAttributes([])); |
|
|
|
|
|
|
38
|
|
|
$this->assertNotSame($menu, $menu->beforeClass('')); |
|
|
|
|
|
|
39
|
|
|
$this->assertNotSame($menu, $menu->beforeContent('')); |
|
|
|
|
|
|
40
|
|
|
$this->assertNotSame($menu, $menu->beforeTag('')); |
|
|
|
|
|
|
41
|
|
|
$this->assertNotSame($menu, $menu->class('')); |
|
|
|
|
|
|
42
|
|
|
$this->assertNotSame($menu, $menu->container(false)); |
|
|
|
|
|
|
43
|
|
|
$this->assertNotSame($menu, $menu->currentPath('')); |
|
|
|
|
|
|
44
|
|
|
$this->assertNotSame($menu, $menu->disabledClass('')); |
|
|
|
|
|
|
45
|
|
|
$this->assertNotSame($menu, $menu->dropdownContainerClass('')); |
|
|
|
|
|
|
46
|
|
|
$this->assertNotSame($menu, $menu->dropdownDefinitions([])); |
|
|
|
|
|
|
47
|
|
|
$this->assertNotSame($menu, $menu->firstItemClass('')); |
|
|
|
|
|
|
48
|
|
|
$this->assertNotSame($menu, $menu->iconContainerAttributes([])); |
|
|
|
|
|
|
49
|
|
|
$this->assertNotSame($menu, $menu->items([])); |
|
|
|
|
|
|
50
|
|
|
$this->assertNotSame($menu, $menu->itemsContainerAttributes([])); |
|
|
|
|
|
|
51
|
|
|
$this->assertNotSame($menu, $menu->itemsContainerClass('')); |
|
|
|
|
|
|
52
|
|
|
$this->assertNotSame($menu, $menu->itemsTag('')); |
|
|
|
|
|
|
53
|
|
|
$this->assertNotSame($menu, $menu->lastItemClass('')); |
|
|
|
|
|
|
54
|
|
|
$this->assertNotSame($menu, $menu->linkAttributes([])); |
|
|
|
|
|
|
55
|
|
|
$this->assertNotSame($menu, $menu->linkClass('')); |
|
|
|
|
|
|
56
|
|
|
$this->assertNotSame($menu, $menu->linkTag('')); |
|
|
|
|
|
|
57
|
|
|
$this->assertNotSame($menu, $menu->tagName('')); |
|
|
|
|
|
|
58
|
|
|
$this->assertNotSame($menu, $menu->template('')); |
|
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|