getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); $mockedLogger = $this->createMock(LoggerInterface::class); $expiration = new Expiration($mockedConfig, $mockedTimeFactory, $mockedLogger); $actualResult = $expiration->isExpired($timestamp, $quotaExceeded); $this->assertEquals($expectedResult, $actualResult); } private function getMockedTimeFactory(int $time): ITimeFactory&MockObject { $mockedTimeFactory = $this->createMock(ITimeFactory::class); $mockedTimeFactory->expects($this->any()) ->method('getTime') ->willReturn($time); return $mockedTimeFactory; } private function getMockedConfig(string $returnValue): IConfig&MockObject { $mockedConfig = $this->createMock(IConfig::class); $mockedConfig->expects($this->any()) ->method('getSystemValue') ->willReturn($returnValue); return $mockedConfig; } }