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); } /** * @param int $time * @return ITimeFactory|MockObject */ private function getMockedTimeFactory($time) { $mockedTimeFactory = $this->createMock(ITimeFactory::class); $mockedTimeFactory->expects($this->any()) ->method('getTime') ->willReturn($time); return $mockedTimeFactory; } /** * @param string $returnValue * @return IConfig|MockObject */ private function getMockedConfig($returnValue) { $mockedConfig = $this->createMock(IConfig::class); $mockedConfig->expects($this->any()) ->method('getSystemValue') ->willReturn($returnValue); return $mockedConfig; } }