Skip to content

Commit

Permalink
Merge pull request #32 from bwaidelich/fix-JobManagerTest
Browse files Browse the repository at this point in the history
BUGFIX: Adjust JobManagerTest to latest phpunit changes
  • Loading branch information
daniellienert authored Jun 19, 2018
2 parents 10e92b9 + 3d7acc9 commit 301d778
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Tests/Functional/Job/JobManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
use Flowpack\JobQueue\Common\Tests\Unit\Fixtures\TestJob;
use Flowpack\JobQueue\Common\Tests\Unit\Fixtures\TestQueue;
use Neos\Flow\Tests\FunctionalTestCase;
use PHPUnit\Framework\Constraint\Constraint;
use PHPUnit\Framework\Constraint\IsInstanceOf;
use PHPUnit\Framework\MockObject\MockObject;

/**
* Functional tests for the JobManager
Expand All @@ -32,7 +35,7 @@ class JobManagerTest extends FunctionalTestCase


/**
* @var QueueManager|\PHPUnit_Framework_MockObject_MockObject
* @var QueueManager|MockObject
*/
protected $mockQueueManager;

Expand Down Expand Up @@ -104,7 +107,7 @@ protected function assertSignalEmitted($signalName, array $arguments = [])
$this->assertCount(1, $this->emittedSignals[$fullSignalName]);
foreach ($arguments as $argumentIndex => $expectedArgument) {
$actualArgument = $this->emittedSignals[$fullSignalName][0][$argumentIndex];
if ($expectedArgument instanceof \PHPUnit_Framework_Constraint) {
if ($expectedArgument instanceof Constraint) {
$expectedArgument->evaluate($actualArgument);
} else {
$this->assertSame($expectedArgument, $actualArgument);
Expand Down Expand Up @@ -139,7 +142,7 @@ public function waitAndExecuteEmitsMessageReservedSignal()
{
$this->jobManager->queue('TestQueue', new TestJob());
$this->jobManager->waitAndExecute('TestQueue');
$this->assertSignalEmitted('messageReserved', [0 => $this->testQueue, 1 => new \PHPUnit_Framework_Constraint_IsInstanceOf(Message::class)]);
$this->assertSignalEmitted('messageReserved', [0 => $this->testQueue, 1 => new IsInstanceOf(Message::class)]);
}

/**
Expand All @@ -149,7 +152,7 @@ public function waitAndExecuteEmitsMessageFinishedSignal()
{
$this->jobManager->queue('TestQueue', new TestJob());
$this->jobManager->waitAndExecute('TestQueue');
$this->assertSignalEmitted('messageFinished', [0 => $this->testQueue, 1 => new \PHPUnit_Framework_Constraint_IsInstanceOf(Message::class)]);
$this->assertSignalEmitted('messageFinished', [0 => $this->testQueue, 1 => new IsInstanceOf(Message::class)]);
}

/**
Expand All @@ -164,7 +167,7 @@ public function waitAndExecuteEmitsMessageReleasedSignal()
$this->jobManager->waitAndExecute('TestQueue');
} catch (JobQueueException $exception) {
}
$this->assertSignalEmitted('messageReleased', [$this->testQueue, new \PHPUnit_Framework_Constraint_IsInstanceOf(Message::class), $releaseOptions, new \PHPUnit_Framework_Constraint_IsInstanceOf(JobQueueException::class)]);
$this->assertSignalEmitted('messageReleased', [$this->testQueue, new IsInstanceOf(Message::class), $releaseOptions, new IsInstanceOf(JobQueueException::class)]);
}

/**
Expand All @@ -177,6 +180,6 @@ public function waitAndExecuteEmitsMessageFailedSignal()
$this->jobManager->waitAndExecute('TestQueue');
} catch (JobQueueException $exception) {
}
$this->assertSignalEmitted('messageFailed', [$this->testQueue, new \PHPUnit_Framework_Constraint_IsInstanceOf(Message::class)]);
$this->assertSignalEmitted('messageFailed', [$this->testQueue, new IsInstanceOf(Message::class)]);
}
}
}

0 comments on commit 301d778

Please sign in to comment.