Skip to content

Commit c7a8581

Browse files
authored
remove alias events (#101)
1 parent 1f9bd2f commit c7a8581

File tree

5 files changed

+1
-85
lines changed

5 files changed

+1
-85
lines changed

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ TEMP_TEST_OUTPUT=/tmp/sse-contract-test-service.log
66
# - "secondary": In the PHP SDK this is not an addressable attribute for clauses; in other
77
# SDKs, it is. This was underspecified in the past; in future major versions, the other
88
# SDKs and the contract tests will be in line with the PHP behavior.
9-
# - "date - bad syntax", "semver - bad type": The PHP SDK has insufficiently strict
10-
# validation for these types. We will definitely fix this in 5.0 but may or may not
11-
# address it in 4.x, since it does not prevent any valid values from working.
129
TEST_HARNESS_PARAMS := $(TEST_HARNESS_PARAMS) \
1310
-skip 'evaluation/parameterized/secondary' \
14-
-skip 'evaluation/parameterized/operators - date - bad syntax' \
15-
-skip 'evaluation/parameterized/operators - semver - bad type'
11+
-skip 'events/alias'
1612

1713
build-contract-tests:
1814
@cd test-service && composer install --no-progress

src/LaunchDarkly/Impl/Events/EventFactory.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,6 @@ public function newCustomEvent(string $eventName, LDUser $user, $data, $metricVa
160160
return $e;
161161
}
162162

163-
/**
164-
* @return (mixed|null)[]
165-
*/
166-
public function newAliasEvent(LDUser $user, LDUser $previousUser): array
167-
{
168-
$e = [
169-
'kind' => 'alias',
170-
'key' => strval($user->getKey()),
171-
'contextKind' => static::contextKind($user),
172-
'previousKey' => strval($previousUser->getKey()),
173-
'previousContextKind' => static::contextKind($previousUser),
174-
'creationDate' => Util::currentTimeUnixMillis()
175-
];
176-
177-
return $e;
178-
}
179-
180163
private static function contextKind(LDUser $user): string
181164
{
182165
if ($user->getAnonymous()) {

src/LaunchDarkly/LDClient.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -385,33 +385,6 @@ public function allFlagsState(LDUser $user, array $options = []): FeatureFlagsSt
385385
return $state;
386386
}
387387

388-
/**
389-
* Associates two users for analytics purposes.
390-
*
391-
* This can be helpful in the situation where a person is represented by multiple
392-
* LaunchDarkly users. This may happen, for example, when a person initially logs into
393-
* an application-- the person might be represented by an anonymous user prior to logging
394-
* in and a different user after logging in, as denoted by a different user key.
395-
*
396-
* @param LDUser $user the newly identified user.
397-
* @param LDUser $previousUser the previously identified user.
398-
*/
399-
public function alias(LDUser $user, LDUser $previousUser): void
400-
{
401-
if (is_null($user->getKey())) {
402-
$this->_logger->warning("Alias called with null/empty user!");
403-
return;
404-
}
405-
406-
if (is_null($previousUser->getKey())) {
407-
$this->_logger->warning("Alias called with null/empty previousUser!");
408-
return;
409-
}
410-
411-
$event = $this->_eventFactoryDefault->newAliasEvent($user, $previousUser);
412-
$this->_eventProcessor->enqueue($event);
413-
}
414-
415388
/**
416389
* Generates an HMAC sha256 hash for use in Secure mode.
417390
*

test-service/SdkClientEntity.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ public function doCommand($reqParams)
5353
$command = $reqParams['command'];
5454
$commandParams = $reqParams[$command] ?? null;
5555
switch ($command) {
56-
case 'aliasEvent':
57-
$this->doAliasEvent($commandParams);
58-
return null;
59-
6056
case 'customEvent':
6157
$this->doCustomEvent($commandParams);
6258
return null;
@@ -83,14 +79,6 @@ public function doCommand($reqParams)
8379
}
8480
}
8581

86-
private function doAliasEvent($params)
87-
{
88-
$this->_client->alias(
89-
$this->makeUser($params['user']),
90-
$this->makeUser($params['previousUser'])
91-
);
92-
}
93-
9482
private function doCustomEvent($params)
9583
{
9684
$this->_client->track(

tests/LDClientTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -651,30 +651,6 @@ public function testTrackWithAnonymousUserSendsEventWithAnonymousContextKind()
651651
$this->assertEquals('anonymousUser', $event['contextKind']);
652652
}
653653

654-
public function testAliasEventsAreCorrect()
655-
{
656-
$ep = new MockEventProcessor();
657-
$client = $this->makeClient(['event_processor' => $ep]);
658-
659-
$user_builder = new LDUserBuilder("[email protected]");
660-
$user = $user_builder->anonymous(false)->build();
661-
$anon_builder = new LDUserBuilder("[email protected]");
662-
$anon = $anon_builder->anonymous(true)->build();
663-
664-
$client->alias($user, $anon);
665-
666-
$queue = $ep->getEvents();
667-
$this->assertEquals(1, sizeof($queue));
668-
669-
$event = $queue[0];
670-
671-
$this->assertEquals('alias', $event['kind']);
672-
$this->assertEquals($user->getKey(), $event['key']);
673-
$this->assertEquals('user', $event['contextKind']);
674-
$this->assertEquals($anon->getKey(), $event['previousKey']);
675-
$this->assertEquals('anonymousUser', $event['previousContextKind']);
676-
}
677-
678654
public function testEventsAreNotPublishedIfSendEventsIsFalse()
679655
{
680656
// In order to do this test, we cannot provide a mock object for Event_Processor_,

0 commit comments

Comments
 (0)