public function getUserIDForVisitorContactID(int $cid): int
{
if (empty($this->session->get('remote'))) {
- return false;
+ return 0;
}
return array_search($cid, $this->session->get('remote'));
{
return !$this->session->get('authenticated', false);
}
-
+
/** {@inheritDoc} */
public function setVisitorsContacts(string $my_url)
{
$this->setTemplate('wall');
$this->toplevel = $this->getId() == $this->getDataValue('parent');
- if (!empty(DI::userSession()->getUserIDForVisitorContactID($this->getDataValue('contact-id')))) {
+ if (DI::userSession()->getUserIDForVisitorContactID($this->getDataValue('contact-id')) !== 0) {
$this->visiting = true;
}
'data' => [
'remote' => ['3' => '21'],
],
- 'expected' => false,
+ 'expected' => 0,
],
'empty' => [
'cid' => 21,
'data' => [
],
- 'expected' => false,
+ 'expected' => 0,
],
];
}
public function testGetUserIdForVisitorContactID(int $cid, array $data, $expected)
{
$userSession = new UserSession(new ArraySession($data));
- $this->assertEquals($expected, $userSession->getUserIDForVisitorContactID($cid));
+ $this->assertSame($expected, $userSession->getUserIDForVisitorContactID($cid));
}
public function dataAuthenticated()