Skip to content

Commit

Permalink
Merge pull request #9 from mbiencinto/feature/SR-120
Browse files Browse the repository at this point in the history
[SR-120] - add isEnabled function
  • Loading branch information
mbiencinto authored Apr 9, 2021
2 parents 6be060d + 9a1e333 commit 291fe37
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 @@ -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'];
}
}
10 changes: 10 additions & 0 deletions Tests/Unit/EventSubscriber/AmpOptimizerSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 291fe37

Please sign in to comment.