1 | <?php |
||||
2 | |||||
3 | declare(strict_types=1); |
||||
4 | |||||
5 | namespace Yiisoft\Yii\Widgets\Tests\FragmentCache; |
||||
6 | |||||
7 | use PHPUnit\Framework\TestCase; |
||||
8 | use Yiisoft\Cache\Dependency\TagDependency; |
||||
9 | use Yiisoft\Definitions\Exception\CircularReferenceException; |
||||
10 | use Yiisoft\Definitions\Exception\InvalidConfigException; |
||||
11 | use Yiisoft\Definitions\Exception\NotInstantiableException; |
||||
12 | use Yiisoft\Factory\NotFoundException; |
||||
13 | use Yiisoft\View\Cache\DynamicContent; |
||||
14 | use Yiisoft\Yii\Widgets\FragmentCache; |
||||
15 | use Yiisoft\Yii\Widgets\Tests\Support\TestTrait; |
||||
16 | |||||
17 | /** |
||||
18 | * @psalm-suppress PropertyNotSetInConstructor |
||||
19 | */ |
||||
20 | final class ImmutableTest extends TestCase |
||||
21 | { |
||||
22 | use TestTrait; |
||||
23 | |||||
24 | /** |
||||
25 | * @throws CircularReferenceException |
||||
26 | * @throws InvalidConfigException |
||||
27 | * @throws NotFoundException |
||||
28 | * @throws NotInstantiableException |
||||
29 | */ |
||||
30 | public function testImmutable(): void |
||||
31 | { |
||||
32 | $widget = FragmentCache::widget(); |
||||
33 | $this->assertNotSame($widget, $widget->id('')); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
34 | $this->assertNotSame($widget, $widget->ttl(3600)); |
||||
0 ignored issues
–
show
The method
ttl() does not exist on Yiisoft\Widget\Widget . It seems like you code against a sub-type of Yiisoft\Widget\Widget such as Yiisoft\Yii\Widgets\FragmentCache .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
35 | $this->assertNotSame($widget, $widget->dependency(new TagDependency('test'))); |
||||
0 ignored issues
–
show
The method
dependency() does not exist on Yiisoft\Widget\Widget . It seems like you code against a sub-type of Yiisoft\Widget\Widget such as Yiisoft\Yii\Widgets\FragmentCache .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
36 | $this->assertNotSame($widget, $widget->dynamicContents(new DynamicContent('test', fn (): string => 'test'))); |
||||
0 ignored issues
–
show
The method
dynamicContents() does not exist on Yiisoft\Widget\Widget . It seems like you code against a sub-type of Yiisoft\Widget\Widget such as Yiisoft\Yii\Widgets\FragmentCache .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
37 | $this->assertNotSame($widget, $widget->variations('')); |
||||
0 ignored issues
–
show
The method
variations() does not exist on Yiisoft\Widget\Widget . It seems like you code against a sub-type of Yiisoft\Widget\Widget such as Yiisoft\Yii\Widgets\FragmentCache .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
38 | } |
||||
39 | } |
||||
40 |