2
2
/**
3
3
* Copyright 2016, Optimizely
4
4
*
5
- * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * Licensed under the Apache License, Version 2.0 (the \ "License\ ");
6
6
* you may not use this file except in compliance with the License.
7
7
* You may obtain a copy of the License at
8
8
*
9
9
* http://www.apache.org/licenses/LICENSE-2.0
10
10
*
11
11
* 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,
13
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
* See the License for the specific language governing permissions and
15
15
* limitations under the License.
@@ -29,7 +29,7 @@ class ConditionEvaluatorTest extends \PHPUnit_Framework_TestCase
29
29
public function setUp ()
30
30
{
31
31
$ 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 \" }]]] ] " ;
33
33
$ decoder ->deserializeAudienceConditions ($ conditions );
34
34
35
35
$ this ->conditionsList = $ decoder ->getConditionsList ();
@@ -41,7 +41,7 @@ public function testEvaluateConditionsMatch()
41
41
$ userAttributes = [
42
42
'device_type ' => 'iPhone ' ,
43
43
'location ' => 'San Francisco ' ,
44
- 'browser ' => 'chrome '
44
+ 'browser ' => 'Chrome '
45
45
];
46
46
47
47
$ this ->assertTrue ($ this ->conditionEvaluator ->evaluate ($ this ->conditionsList , $ userAttributes ));
@@ -51,8 +51,9 @@ public function testEvaluateConditionsMatch()
51
51
public function testEvaluateConditionsDoNotMatch ()
52
52
{
53
53
$ userAttributes = [
54
+ 'device_type ' => 'iPhone ' ,
54
55
'location ' => 'San Francisco ' ,
55
- 'browser ' => 'chrome '
56
+ 'browser ' => 'Firefox '
56
57
];
57
58
58
59
$ this ->assertFalse ($ this ->conditionEvaluator ->evaluate ($ this ->conditionsList , $ userAttributes ));
0 commit comments