diff --git a/EventSubscriber/AmpOptimizerSubscriber.php b/EventSubscriber/AmpOptimizerSubscriber.php index 806f835..cf2db5a 100644 --- a/EventSubscriber/AmpOptimizerSubscriber.php +++ b/EventSubscriber/AmpOptimizerSubscriber.php @@ -151,4 +151,12 @@ public function setEnabled(bool $enabled): void { $this->config['transform_enabled'] = $enabled; } + + /** + * @return bool + */ + public function isEnabled(): bool + { + return $this->config['transform_enabled']; + } } \ No newline at end of file diff --git a/Tests/Unit/EventSubscriber/AmpOptimizerSubscriberTest.php b/Tests/Unit/EventSubscriber/AmpOptimizerSubscriberTest.php index b4ae227..d3aa078 100644 --- a/Tests/Unit/EventSubscriber/AmpOptimizerSubscriberTest.php +++ b/Tests/Unit/EventSubscriber/AmpOptimizerSubscriberTest.php @@ -304,6 +304,16 @@ public function testDisabledByProperty() $instance->onKernelResponse($event); } + /** + * Test isEnabled property + */ + public function testIsEnabledProperty() + { + $instance = $this->getInstanceDisabledByProperty(); + $instance->setEnabled(false); + $this->assertFalse($instance->isEnabled()); + } + /** * Provide instance to test with disabled by property and test calls * @return AmpOptimizerSubscriber