/** * Tests delete method */ public function testRead() { $cronTasks = array($this->_tblCronTaskMocks->getBasicMock(), $this->_tblCronTaskMocks->getBasicMock()); $sut = $this->_getSut($cronTasks); $this->assertEquals($cronTasks, $sut->getAllCronTasks()); $this->assertEquals($cronTasks, $sut->getActiveCronTasks()); }
public function testCreateCommandDoesntExists() { $cronTaskMock = $this->_tblCronTaskMocks->getCustomMock($name = 'test', $description = 'test description', $command = 'cron:test', $cronExpression = '*/5 * * * *'); $sut = $this->getSut($cronTaskMock, $persistedAndFlushedNumCalls = 0, $commandExists = false); $this->setExpectedException('Trovit\\CronManagerBundle\\Exception\\CommandNotExistsException'); $sut->create($name, $description, $command, $cronExpression); }
/** * Tests updateLastRun method */ public function testUpdateLastRun() { $cronTaskMock = $this->_tblCronTaskMocks->getCustomMock($name = 'test', $description = 'test description', $command = 'cron:test', $cronExpression = '*/5 * * * *'); $cronTaskAfterUpdateMock = clone $cronTaskMock; $dateTime = new \DateTime(); $cronTaskAfterUpdateMock->setLastRun($dateTime); $sut = $this->getSut($cronTaskAfterUpdateMock, $flushedNumCalls = 1, $commandExistsNumCalls = 0, $commandExists = true); $sut->updateLastRun($cronTaskMock, $dateTime); }
/** * Tests deleteById method */ public function testDeleteByIdOk() { $cronTaskMock = $this->_tblCronTaskMocks->getBasicMock(); $sut = $this->_getSutDeleteById($id = 3, $cronTaskMock, 1); $sut->deleteById($id); }
/** * Tests executeCrons method */ public function testExecuteCronsNoDue() { $cronTasks = array($this->_tblCronTaskMocks->getCustomMock('test-command', 'Test command', 'cron:test-command', '*/10 * * * *', new \DateTime('01/01/2016 09:50:00'))); $sut = $this->_getSut($cronTasks, $executeBackgroundCommandNumCalls = 0, false); $sut->executeCrons(false); }