コード例 #1
0
 /**
  * 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());
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 /**
  * 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);
 }
コード例 #4
0
 /**
  * Tests deleteById method
  */
 public function testDeleteByIdOk()
 {
     $cronTaskMock = $this->_tblCronTaskMocks->getBasicMock();
     $sut = $this->_getSutDeleteById($id = 3, $cronTaskMock, 1);
     $sut->deleteById($id);
 }
コード例 #5
0
 /**
  * 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);
 }