Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Person ID not cast to string #562

Merged
merged 2 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed Person ID not cast to string
  • Loading branch information
danielmorell committed Mar 30, 2022
commit 64c01b452fb89403a0fa6dbba88f816f42e4f108
2 changes: 1 addition & 1 deletion src/DataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ protected function getPerson()
return null;
}

$identifier = $personData['id'];
$identifier = (string)$personData['id'];

$email = null;
if ($this->captureEmail && isset($personData['email'])) {
Expand Down
21 changes: 20 additions & 1 deletion tests/DataBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,25 @@ public function testPersonFunc()
$output = $dataBuilder->makeData(Level::ERROR, "testing", array());
$this->assertEquals('123', $output->getPerson()->getId());
}

public function testPersonIntID()
{
$dataBuilder = new DataBuilder(array(
'accessToken' => $this->getTestAccessToken(),
'environment' => 'tests',
'person' => array(
'id' => 123,
'username' => 'tester',
'email' => '[email protected]'
),
'levelFactory' => new LevelFactory,
'utilities' => new Utilities
));
$output = $dataBuilder->makeData(Level::ERROR, "testing", array());
$this->assertEquals('123', $output->getPerson()->getId());
$this->assertNull($output->getPerson()->getUsername());
$this->assertNull($output->getPerson()->getEmail());
}

public function testPersonFuncException()
{
Expand Down Expand Up @@ -904,7 +923,7 @@ public function testFramesOrder()
);
// 900 is the line number where the comment "// A" is found
$this->assertEquals(
900,
919,
$frames[count($frames)-1]->getLineno(),
"Possible false negative: did this file change? Check the line number for line with '// A' comment"
);
Expand Down