Skip to content

Commit

Permalink
[SR-120] - add isEnabled function
Browse files Browse the repository at this point in the history
  • Loading branch information
mbiencinto committed Apr 8, 2021
1 parent 7bfcfb1 commit 9a1e333
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions EventSubscriber/AmpOptimizerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,12 @@ public function setEnabled(bool $enabled): void
{
$this->config['transform_enabled'] = $enabled;
}

/**
* @return bool
*/
public function isEnabled(): bool
{
return $this->config['transform_enabled'];
}
}
10 changes: 10 additions & 0 deletions Tests/Unit/EventSubscriber/AmpOptimizerSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,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
Expand Down

0 comments on commit 9a1e333

Please sign in to comment.