mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 04:03:12 +08:00
Apply fixes for PHPUnit 13
This commit is contained in:
@@ -111,7 +111,7 @@ class DomainServiceTest extends TestCase
|
||||
#[Test, AllowMockObjectsWithoutExpectations]
|
||||
public function getDomainThrowsExceptionWhenDomainIsNotFound(): void
|
||||
{
|
||||
$this->em->method('find')->with(Domain::class, '123')->willReturn(null);
|
||||
$this->em->method('find')->willReturnMap([[Domain::class, '123', null]]);
|
||||
|
||||
$this->expectException(DomainNotFoundException::class);
|
||||
|
||||
@@ -122,7 +122,7 @@ class DomainServiceTest extends TestCase
|
||||
public function getDomainReturnsEntityWhenFound(): void
|
||||
{
|
||||
$domain = Domain::withAuthority('');
|
||||
$this->em->method('find')->with(Domain::class, '123')->willReturn($domain);
|
||||
$this->em->method('find')->willReturnMap([[Domain::class, '123', $domain]]);
|
||||
|
||||
$result = $this->domainService->getDomain('123');
|
||||
|
||||
@@ -136,7 +136,6 @@ class DomainServiceTest extends TestCase
|
||||
$this->repo->expects($this->once())->method('findOneByAuthority')->with($authority, $apiKey)->willReturn(
|
||||
$foundDomain,
|
||||
);
|
||||
$this->em->method('persist')->with($foundDomain ?? $this->isInstanceOf(Domain::class));
|
||||
|
||||
$result = $this->domainService->getOrCreate($authority, $apiKey);
|
||||
|
||||
@@ -168,7 +167,6 @@ class DomainServiceTest extends TestCase
|
||||
$this->repo->expects($this->once())->method('findOneByAuthority')->with($authority, $apiKey)->willReturn(
|
||||
$foundDomain,
|
||||
);
|
||||
$this->em->method('persist')->with($foundDomain ?? $this->isInstanceOf(Domain::class));
|
||||
|
||||
$result = $this->domainService->configureNotFoundRedirects($authority, NotFoundRedirects::withRedirects(
|
||||
'foo.com',
|
||||
|
||||
@@ -229,7 +229,7 @@ class ImportedLinksProcessorTest extends TestCase
|
||||
$this->em->expects($this->exactly($amountOfPersistedVisits + ($foundShortUrl === null ? 1 : 0)))->method(
|
||||
'persist',
|
||||
)->with($this->callback(fn (object $arg) => $arg instanceof ShortUrl || $arg instanceof Visit));
|
||||
$this->em->expects($this->any())->method('find')->willReturn(null);
|
||||
$this->em->method('find')->willReturn(null);
|
||||
$this->io->expects($this->once())->method('text')->with($this->stringContains($expectedOutput));
|
||||
|
||||
$this->processor->process($this->io, ImportResult::withShortUrls([$importedUrl]), $this->buildParams());
|
||||
|
||||
@@ -116,15 +116,12 @@ class MatomoVisitSenderTest extends TestCase
|
||||
#[Test, DataProvider('provideUrlsToTrack')]
|
||||
public function properUrlIsTracked(Visit $visit, string $expectedTrackedUrl): void
|
||||
{
|
||||
$tracker = $this->createMock(MatomoTracker::class);
|
||||
$tracker->expects($this->once())->method('setUrl')->with($expectedTrackedUrl)->willReturn($tracker);
|
||||
$tracker->expects($this->once())->method('setUserAgent')->willReturn($tracker);
|
||||
$tracker->expects($this->once())->method('setUrlReferrer')->willReturn($tracker);
|
||||
$tracker->expects($this->any())->method('setCustomTrackingParameter')->willReturn($tracker);
|
||||
$tracker->expects($this->once())->method('doTrackPageView');
|
||||
$tracker->expects($this->once())->method('setForceVisitDateTime')->with(
|
||||
$visit->date->setTimezone('UTC')->toDateTimeString(),
|
||||
);
|
||||
$tracker = $this->createStub(MatomoTracker::class);
|
||||
$tracker->method('setUrl')->willReturn($tracker);
|
||||
$tracker->method('setUserAgent')->willReturn($tracker);
|
||||
$tracker->method('setUrlReferrer')->willReturn($tracker);
|
||||
$tracker->method('setCustomTrackingParameter')->willReturn($tracker);
|
||||
$tracker->method('doTrackPageView');
|
||||
|
||||
$this->trackerBuilder->expects($this->once())->method('buildMatomoTracker')->willReturn($tracker);
|
||||
|
||||
@@ -156,7 +153,7 @@ class MatomoVisitSenderTest extends TestCase
|
||||
$visitor = Visitor::empty();
|
||||
$bot = Visitor::botInstance();
|
||||
|
||||
$this->visitIterationRepository->method('findAllVisits')->with($dateRange)->willReturn([
|
||||
$this->visitIterationRepository->method('findAllVisits')->willReturn([
|
||||
Visit::forBasePath($bot),
|
||||
Visit::forValidShortUrl(ShortUrl::createFake(), $visitor),
|
||||
Visit::forInvalidShortUrl($visitor),
|
||||
|
||||
Reference in New Issue
Block a user