/** * @return void */ public function testDeleteRecordsOlderThen() { $timestamp = 12345; $this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->dbAdapterMock); $this->dbAdapterMock->expects($this->once())->method('delete')->with($this->model->getMainTable(), ['created_at < ?' => $this->dateTimeMock->formatDate($timestamp)])->willReturnSelf(); $this->assertEquals($this->model, $this->model->deleteRecordsOlderThen($timestamp)); }
/** * @magentoDataFixture Magento/Security/_files/password_reset_request_events.php */ public function testDeleteRecordsOlderThen() { /** @var \Magento\Security\Model\PasswordResetRequestEvent $passwordResetRequestEvent */ $countBefore = $this->model->getCollection()->count(); $this->resourceModel->deleteRecordsOlderThen(strtotime('2016-01-20 12:00:00')); $countAfter = $this->model->getCollection()->count(); $this->assertLessThan($countBefore, $countAfter); }