11<?php
22/**
3- * Copyright 2016-2017 , Optimizely
3+ * Copyright 2016-2018 , Optimizely
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
3636
3737class OptimizelyTest extends \PHPUnit_Framework_TestCase
3838{
39+ const OUTPUT_STREAM = 'output ' ;
40+
3941 private $ datafile ;
4042 private $ eventBuilderMock ;
4143 private $ loggerMock ;
@@ -138,7 +140,7 @@ public function testValidateDatafileInvalidFileJsonValidationNotSkipped()
138140
139141 $ this ->assertFalse (
140142 $ validateInputsMethod ->invoke (
141- new Optimizely ('Random datafile ' ),
143+ new Optimizely ('Random datafile ' , null , new DefaultLogger (Logger:: INFO , self :: OUTPUT_STREAM ) ),
142144 'Random datafile ' ,
143145 false
144146 )
@@ -164,7 +166,7 @@ public function testValidateDatafileInvalidFileJsonValidationSkipped()
164166 public function testActivateInvalidOptimizelyObject ()
165167 {
166168 $ optimizelyMock = $ this ->getMockBuilder (Optimizely::class)
167- ->setConstructorArgs (array ('Random datafile ' , null , $ this -> loggerMock ))
169+ ->setConstructorArgs (array ('Random datafile ' , null , new DefaultLogger (Logger:: INFO , self :: OUTPUT_STREAM ) ))
168170 ->setMethods (array ('sendImpressionEvent ' ))
169171 ->getMock ();
170172
@@ -452,7 +454,7 @@ public function testActivateExperimentNotRunning()
452454
453455 public function testGetVariationInvalidOptimizelyObject ()
454456 {
455- $ optlyObject = new Optimizely ('Random datafile ' );
457+ $ optlyObject = new Optimizely ('Random datafile ' , null , new DefaultLogger (Logger:: INFO , self :: OUTPUT_STREAM ) );
456458 $ optlyObject ->getVariation ('some_experiment ' , 'some_user ' );
457459 $ this ->expectOutputRegex ('/Datafile has invalid format. Failing "getVariation"./ ' );
458460 }
@@ -665,7 +667,7 @@ public function testValidatePreconditionsUserNotInForcedVariationInExperiment()
665667
666668 public function testTrackInvalidOptimizelyObject ()
667669 {
668- $ optlyObject = new Optimizely ('Random datafile ' );
670+ $ optlyObject = new Optimizely ('Random datafile ' , null , new DefaultLogger (Logger:: INFO , self :: OUTPUT_STREAM ) );
669671
670672 // Verify that sendNotifications isn't called
671673 $ this ->notificationCenterMock ->expects ($ this ->never ())
@@ -2157,7 +2159,7 @@ public function testGetVariationBucketingIdAttribute()
21572159
21582160 public function testIsFeatureEnabledGivenInvalidDataFile ()
21592161 {
2160- $ optlyObject = new Optimizely ('Random datafile ' , null , $ this -> loggerMock );
2162+ $ optlyObject = new Optimizely ('Random datafile ' , null , new DefaultLogger (Logger:: INFO , self :: OUTPUT_STREAM ) );
21612163
21622164 $ this ->expectOutputRegex ("/Datafile has invalid format. Failing 'isFeatureEnabled'./ " );
21632165 $ optlyObject ->isFeatureEnabled ("boolean_feature " , "user_id " );
@@ -2365,7 +2367,7 @@ public function testIsFeatureEnabledGivenFeatureFlagIsEnabledAndUserIsNotBeingEx
23652367
23662368 public function testGetEnabledFeaturesGivenInvalidDataFile ()
23672369 {
2368- $ optlyObject = new Optimizely ('Random datafile ' );
2370+ $ optlyObject = new Optimizely ('Random datafile ' , null , new DefaultLogger (Logger:: INFO , self :: OUTPUT_STREAM ) );
23692371
23702372 $ this ->expectOutputRegex ("/Datafile has invalid format. Failing 'getEnabledFeatures'./ " );
23712373
0 commit comments