->getRepository('WallabagCoreBundle:Entry')
->findByUrlAndUserId($url, $this->getUser()->getId());
- $results[$url] = false === $res ? false : true;
+ $results[$url] = $res instanceof Entry ? $res->getId() : false;
}
$json = $this->get('serializer')->serialize($results, 'json');
->getRepository('WallabagCoreBundle:Entry')
->findByUrlAndUserId($url, $this->getUser()->getId());
- $exists = false === $res ? false : true;
+ $exists = $res instanceof Entry ? $res->getId() : false;
$json = $this->get('serializer')->serialize(['exists' => $exists], 'json');
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertEquals(true, $content['exists']);
+ $this->assertEquals(2, $content['exists']);
}
public function testGetEntriesExistsWithManyUrls()
$this->assertArrayHasKey($url1, $content);
$this->assertArrayHasKey($url2, $content);
- $this->assertEquals(true, $content[$url1]);
+ $this->assertEquals(2, $content[$url1]);
$this->assertEquals(false, $content[$url2]);
}