diff --git a/module/Core/test/EventDispatcher/LocateVisitTest.php b/module/Core/test/EventDispatcher/LocateVisitTest.php index 21c3bf1d..ddadde84 100644 --- a/module/Core/test/EventDispatcher/LocateVisitTest.php +++ b/module/Core/test/EventDispatcher/LocateVisitTest.php @@ -168,7 +168,9 @@ class LocateVisitTest extends TestCase $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->locateVisit)($event); diff --git a/module/Core/test/EventDispatcher/Matomo/SendVisitToMatomoTest.php b/module/Core/test/EventDispatcher/Matomo/SendVisitToMatomoTest.php index 154c7943..b76a1d31 100644 --- a/module/Core/test/EventDispatcher/Matomo/SendVisitToMatomoTest.php +++ b/module/Core/test/EventDispatcher/Matomo/SendVisitToMatomoTest.php @@ -160,13 +160,10 @@ class SendVisitToMatomoTest extends TestCase $visitId = '123'; $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->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->once())->method('error')->with( 'An error occurred while trying to send visit to Matomo. {e}',