diff --git a/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php b/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php index 2d29698a..c8d22c36 100644 --- a/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php +++ b/src/Optimizely/OptimizelyConfig/OptimizelyConfigService.php @@ -83,6 +83,8 @@ class OptimizelyConfigService */ private readonly LoggerInterface $logger; + private ProjectConfigInterface $projectConfig; + public function __construct(ProjectConfigInterface $projectConfig, LoggerInterface $logger = null) { $this->experiments = $projectConfig->getAllExperiments(); diff --git a/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php b/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php index c3b885f8..cdb5315e 100644 --- a/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php +++ b/src/Optimizely/Utils/CustomAttributeConditionEvaluator.php @@ -19,6 +19,7 @@ use Monolog\Logger; use Optimizely\Enums\CommonAudienceEvaluationLogs as logs; +use Optimizely\Logger\LoggerInterface; use Optimizely\Utils\SemVersionConditionEvaluator; use Optimizely\Utils\Validator; @@ -44,13 +45,15 @@ class CustomAttributeConditionEvaluator */ protected $userAttributes; + private LoggerInterface $logger; + /** * CustomAttributeConditionEvaluator constructor * * @param array $userAttributes Associative array of user attributes to values. * @param $logger LoggerInterface. */ - public function __construct(array $userAttributes, $logger) + public function __construct(array $userAttributes, LoggerInterface $logger) { $this->userAttributes = $userAttributes; $this->logger = $logger; diff --git a/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php b/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php index cdf0ee89..f9c6ad86 100644 --- a/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php +++ b/tests/UtilsTests/CustomAttributeConditionEvaluatorLoggingTest.php @@ -20,12 +20,13 @@ use Monolog\Logger; use Optimizely\Utils\CustomAttributeConditionEvaluator; use PHPUnit\Framework\TestCase; +use Optimizely\Logger\LoggerInterface; class CustomAttributeConditionEvaluatorLoggingTest extends TestCase { protected function setUp() :void { - $this->loggerMock = $this->getMockBuilder(NoOpLogger::class) + $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) ->setMethods(array('log')) ->getMock(); } diff --git a/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php b/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php index fabf6828..3900f082 100644 --- a/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php +++ b/tests/UtilsTests/CustomAttributeConditionEvaluatorTest.php @@ -19,12 +19,13 @@ use Optimizely\Utils\CustomAttributeConditionEvaluator; use PHPUnit\Framework\TestCase; +use Optimizely\Logger\LoggerInterface; class CustomAttributeConditionEvaluatorTest extends TestCase { protected function setUp() : void { - $this->loggerMock = $this->getMockBuilder(NoOpLogger::class) + $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) ->setMethods(array('log')) ->getMock();