/** * @test */ public function stoppWorkWhenMemoryExceeds() { $queueName = 'test' . uniqid(); $timeout = 3; $memoryLimit = 123; $this->extensionConfiguration->expects($this->any())->method('get')->with('memoryLimit')->will($this->returnValue($memoryLimit)); $job = new TestJob(); $this->jobManager->expects($this->once())->method('waitAndExecute')->with($queueName, $timeout)->will($this->returnValue($job)); $this->worker->expects($this->any())->method('memoryExceeded')->with($memoryLimit)->will($this->returnValue(true)); $this->worker->work($queueName, $timeout, Worker::LIMIT_QUEUE); }
/** * @test * @depends waitAndExecuteJobThrowsException */ public function waitAndExecuteJobAttempsThreeTimes() { $attemps = 3; $this->extensionConfiguration->expects($this->any())->method('get')->will($this->returnValue($attemps)); $job = $this->getMock(TestJob::class, array('execute'), array(), '', false); $job->expects($this->any())->method('execute')->will($this->returnValue(false)); $this->jobManager->initializeObject(); $this->jobManager->queue($this->queueName, $job); $this->failedJobRepository->expects($this->once())->method('add'); for ($i = 0; $i < $attemps + 99; ++$i) { try { $queuedJob = $this->jobManager->waitAndExecute($this->queueName); if ($queuedJob === null) { break; } } catch (JobQueueException $exception) { if ($i + 1 < $attemps) { $this->assertEquals(1, $this->testQueue->count(), 'Job is not republished to queue!'); } } } $this->assertEquals($attemps, $i, 'To many attemps!'); $this->assertEquals(0, $this->testQueue->count(), 'Queue not empty!'); }
/** * @test */ public function staticSetValue() { ExtensionConfiguration::set('test', 'ExtBase'); $this->assertEquals('ExtBase', ExtensionConfiguration::get('test')); }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jobqueue'])) { $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jobqueue'] = []; } if (TYPO3_MODE === 'BE') { $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'R3H6\\Jobqueue\\Command\\JobCommandController'; } $GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['Jobqueue']['writerConfiguration'] = array(\R3H6\Jobqueue\Configuration\ExtensionConfiguration::get('logLevel') => array('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter' => array('logFile' => 'typo3temp/logs/jobs.log')));