Beispiel #1
0
 public function testFlagForTargetEmailOff()
 {
     $builder = new LDUserBuilder("*****@*****.**");
     $user = $builder->email("*****@*****.**")->build();
     $b = $this->_simpleFlag->evaluate($user);
     $this->assertEquals(true, $b);
 }
Beispiel #2
0
 public function testToggleEventsOff()
 {
     MockFeatureRequester::$val = null;
     $client = new LDClient("someKey", array('feature_requester_class' => '\\LaunchDarkly\\Tests\\MockFeatureRequester', 'events' => false));
     $builder = new LDUserBuilder(3);
     $user = $builder->build();
     $client->toggle('foo', $user, 'argdef');
     $proc = getPrivateField($client, '_eventProcessor');
     $queue = getPrivateField($proc, '_queue');
     $this->assertEquals(0, sizeof($queue));
 }
 public function testGetApc()
 {
     $redis = new \Predis\Client(array("scheme" => "tcp", "host" => 'localhost', "port" => 6379));
     $client = new LDClient("BOGUS_API_KEY", array('feature_requester_class' => '\\LaunchDarkly\\ApcLDDFeatureRequester', 'apc_expiration' => 1));
     $builder = new LDUserBuilder(3);
     $user = $builder->build();
     $redis->del("launchdarkly:features");
     $this->assertEquals("jim", $client->toggle('foo', $user, 'jim'));
     $redis->hset("launchdarkly:features", 'foo', $this->gen_feature("foo", "bar"));
     $this->assertEquals("bar", $client->toggle('foo', $user, 'jim'));
     # cached value so not updated
     $redis->hset("launchdarkly:features", 'foo', $this->gen_feature("foo", "baz"));
     $this->assertEquals("bar", $client->toggle('foo', $user, 'jim'));
     apc_delete("launchdarkly:features.foo");
     $this->assertEquals("baz", $client->toggle('foo', $user, 'jim'));
 }
Beispiel #4
0
 public function testLDUserAnonymous()
 {
     $builder = new LDUserBuilder("*****@*****.**");
     $user = $builder->anonymous(true)->build();
     $this->assertEquals(true, $user->getAnonymous());
     $json = $user->toJSON();
     $this->assertEquals(true, $json['anonymous']);
 }