/** * @return void */ public function testFilterByLifetime() { $lifetime = 600; $timestamp = time(); $this->dateTimeMock->expects($this->once())->method('gmtTimestamp')->willReturn($timestamp); $this->collectionMock->expects($this->once())->method('addFieldToFilter')->with('created_at', ['gt' => $this->collectionMock->getConnection()->formatDate($timestamp - $lifetime)])->willReturnSelf(); $this->assertEquals($this->collectionMock, $this->collectionMock->filterByLifetime($lifetime)); }