mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Added test for findMostRecentOrphanVisit
This commit is contained in:
parent
47f99cf6cc
commit
0aab1bdc4e
@ -491,6 +491,24 @@ class VisitRepositoryTest extends DatabaseTestCase
|
||||
self::assertCount(5, $this->repo->findNonOrphanVisits(new VisitsListFiltering(null, false, null, 5, 5)));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function findMostRecentOrphanVisitReturnsExpectedVisit(): void
|
||||
{
|
||||
$this->assertNull($this->repo->findMostRecentOrphanVisit());
|
||||
|
||||
$lastVisit = Visit::forBasePath(Visitor::emptyInstance());
|
||||
$this->getEntityManager()->persist($lastVisit);
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$this->assertSame($lastVisit, $this->repo->findMostRecentOrphanVisit());
|
||||
|
||||
$lastVisit2 = Visit::forRegularNotFound(Visitor::botInstance());
|
||||
$this->getEntityManager()->persist($lastVisit2);
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$this->assertSame($lastVisit2, $this->repo->findMostRecentOrphanVisit());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{string, string, \Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user