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 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); }