|
13 | 13 | use Piwik\Tests\Framework\Fixture; |
14 | 14 | use Piwik\Tests\Framework\Mock\FakeAccess; |
15 | 15 | use Piwik\Tests\Framework\TestCase\IntegrationTestCase; |
| 16 | +use Piwik\Widget\WidgetConfig; |
16 | 17 |
|
17 | 18 | /** |
18 | 19 | * @group Widgetize |
@@ -83,4 +84,30 @@ public function testIframeShouldBootstrapClientRenderedWidgetForLegacyWidgetizeU |
83 | 84 | $this->assertStringContainsString('clientComponent', $html); |
84 | 85 | $this->assertStringContainsString('TransitionsPage', $html); |
85 | 86 | } |
| 87 | + |
| 88 | + public function testBuildClientWidgetMetadataShouldRejectDisabledWidgets(): void |
| 89 | + { |
| 90 | + $config = new WidgetConfig(); |
| 91 | + $config->setClientSideComponent('Transitions', 'TransitionsPage'); |
| 92 | + $config->disable(); |
| 93 | + |
| 94 | + $this->expectException(\Exception::class); |
| 95 | + $this->expectExceptionMessage('General_ExceptionWidgetNotEnabled'); |
| 96 | + |
| 97 | + $method = new \ReflectionMethod(Controller::class, 'buildClientWidgetMetadata'); |
| 98 | + $method->setAccessible(true); |
| 99 | + $method->invoke($this->controller, $config); |
| 100 | + } |
| 101 | + |
| 102 | + public function testBuildClientWidgetMetadataShouldIgnoreNonWidgetizableWidgets(): void |
| 103 | + { |
| 104 | + $config = new WidgetConfig(); |
| 105 | + $config->setClientSideComponent('Transitions', 'TransitionsPage'); |
| 106 | + $config->setIsNotWidgetizable(); |
| 107 | + |
| 108 | + $method = new \ReflectionMethod(Controller::class, 'buildClientWidgetMetadata'); |
| 109 | + $method->setAccessible(true); |
| 110 | + |
| 111 | + $this->assertNull($method->invoke($this->controller, $config)); |
| 112 | + } |
86 | 113 | } |
0 commit comments