22/**
33 * Copyright 2016, Optimizely
44 *
5- * Licensed under the Apache License, Version 2.0 (the "License");
5+ * Licensed under the Apache License, Version 2.0 (the \ "License\ ");
66 * you may not use this file except in compliance with the License.
77 * You may obtain a copy of the License at
88 *
99 * http://www.apache.org/licenses/LICENSE-2.0
1010 *
1111 * Unless required by applicable law or agreed to in writing, software
12- * distributed under the License is distributed on an "AS IS" BASIS,
12+ * distributed under the License is distributed on an \ "AS IS\ " BASIS,
1313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414 * See the License for the specific language governing permissions and
1515 * limitations under the License.
@@ -29,7 +29,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
2929 public function setUp ()
3030 {
3131 $ decoder = new ConditionDecoder ();
32- $ conditions = "[ \"and \", [ \"or \", [ \"or \", { \"name \": \"device_type \", \"type \": \"custom_attribute \", \"value \": \"iPhone \"}]], [ \"or \", [ \"or \", { \"name \": \"location \", \"type \": \"custom_attribute \", \"value \": \"San Francisco \"}]]] " ;
32+ $ conditions = "[ \"and \", [ \"or \", [ \"or \", { \"name \": \"device_type \", \"type \": \"custom_attribute \", \"value \": \"iPhone \"}]], [ \"or \", [ \"or \", { \"name \": \"location \", \"type \": \"custom_attribute \", \"value \": \"San Francisco \"}]], [ \" or \" , [ \" not \" , [ \" or \" , { \" name \" : \" browser \" , \" type \" : \" custom_attribute \" , \" value \" : \" Firefox \" }]]] ] " ;
3333 $ decoder ->deserializeAudienceConditions ($ conditions );
3434
3535 $ this ->conditionsList = $ decoder ->getConditionsList ();
@@ -41,7 +41,7 @@ public function testEvaluateConditionsMatch()
4141 $ userAttributes = [
4242 'device_type ' => 'iPhone ' ,
4343 'location ' => 'San Francisco ' ,
44- 'browser ' => 'chrome '
44+ 'browser ' => 'Chrome '
4545 ];
4646
4747 $ this ->assertTrue ($ this ->conditionEvaluator ->evaluate ($ this ->conditionsList , $ userAttributes ));
@@ -51,8 +51,9 @@ public function testEvaluateConditionsMatch()
5151 public function testEvaluateConditionsDoNotMatch ()
5252 {
5353 $ userAttributes = [
54+ 'device_type ' => 'iPhone ' ,
5455 'location ' => 'San Francisco ' ,
55- 'browser ' => 'chrome '
56+ 'browser ' => 'Firefox '
5657 ];
5758
5859 $ this ->assertFalse ($ this ->conditionEvaluator ->evaluate ($ this ->conditionsList , $ userAttributes ));
0 commit comments