Fix LocateVisitTest

This commit is contained in:
Alejandro Celaya 2023-11-21 08:25:58 +01:00
parent bd5d3cb6fa
commit c03eea789c
2 changed files with 4 additions and 5 deletions

View File

@ -168,7 +168,9 @@ class LocateVisitTest extends TestCase
$location, $location,
); );
$this->eventDispatcher->expects($this->once())->method('dispatch')->with(new VisitLocated('123')); $this->eventDispatcher->expects($this->once())->method('dispatch')->with(
new VisitLocated('123', $originalIpAddress),
);
$this->logger->expects($this->never())->method('warning'); $this->logger->expects($this->never())->method('warning');
($this->locateVisit)($event); ($this->locateVisit)($event);

View File

@ -160,13 +160,10 @@ class SendVisitToMatomoTest extends TestCase
$visitId = '123'; $visitId = '123';
$e = new Exception('Error!'); $e = new Exception('Error!');
$tracker = $this->createMock(MatomoTracker::class);
$tracker->expects($this->once())->method('setUrl')->willThrowException($e);
$this->em->expects($this->once())->method('find')->with(Visit::class, $visitId)->willReturn( $this->em->expects($this->once())->method('find')->with(Visit::class, $visitId)->willReturn(
$this->createMock(Visit::class), $this->createMock(Visit::class),
); );
$this->trackerBuilder->expects($this->once())->method('buildMatomoTracker')->willReturn($tracker); $this->trackerBuilder->expects($this->once())->method('buildMatomoTracker')->willThrowException($e);
$this->logger->expects($this->never())->method('warning'); $this->logger->expects($this->never())->method('warning');
$this->logger->expects($this->once())->method('error')->with( $this->logger->expects($this->once())->method('error')->with(
'An error occurred while trying to send visit to Matomo. {e}', 'An error occurred while trying to send visit to Matomo. {e}',