| @@ 19-46 (lines=28) @@ | ||
| 16 | use Prophecy\Prophecy\ProphecyInterface; |
|
| 17 | use SlmQueue\Job\JobPluginManager; |
|
| 18 | ||
| 19 | class JobHelperFactoryTest extends TestCase |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var ContainerInterface|ProphecyInterface |
|
| 23 | */ |
|
| 24 | private $container; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function setUp() |
|
| 30 | { |
|
| 31 | $this->container = $this->prophesize(ContainerInterface::class); |
|
| 32 | ||
| 33 | $jobPluginManager = $this->prophesize(JobPluginManager::class); |
|
| 34 | $this->container->get(JobPluginManager::class)->willReturn($jobPluginManager); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function testCallingFactoryReturnsHelperInstance() |
|
| 38 | { |
|
| 39 | $factory = new JobHelperFactory(); |
|
| 40 | $this->assertInstanceOf(JobHelperFactory::class, $factory); |
|
| 41 | ||
| 42 | $class = $factory($this->container->reveal()); |
|
| 43 | ||
| 44 | $this->assertInstanceOf(JobHelper::class, $class); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| @@ 19-46 (lines=28) @@ | ||
| 16 | use Prophecy\Prophecy\ProphecyInterface; |
|
| 17 | use SlmQueue\Queue\QueuePluginManager; |
|
| 18 | ||
| 19 | class QueueHelperFactoryTest extends TestCase |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var ContainerInterface|ProphecyInterface |
|
| 23 | */ |
|
| 24 | private $container; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function setUp() |
|
| 30 | { |
|
| 31 | $this->container = $this->prophesize(ContainerInterface::class); |
|
| 32 | ||
| 33 | $queuePluginManager = $this->prophesize(QueuePluginManager::class); |
|
| 34 | $this->container->get(QueuePluginManager::class)->willReturn($queuePluginManager); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function testCallingFactoryReturnsHelperInstance() |
|
| 38 | { |
|
| 39 | $factory = new QueueHelperFactory(); |
|
| 40 | $this->assertInstanceOf(QueueHelperFactory::class, $factory); |
|
| 41 | ||
| 42 | $class = $factory($this->container->reveal()); |
|
| 43 | ||
| 44 | $this->assertInstanceOf(QueueHelper::class, $class); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| @@ 20-47 (lines=28) @@ | ||
| 17 | use SlmQueue\Worker\WorkerInterface; |
|
| 18 | use SlmQueueDoctrine\Worker\DoctrineWorker; |
|
| 19 | ||
| 20 | class WorkerHelperFactoryTest extends TestCase |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * @var ContainerInterface|ProphecyInterface |
|
| 24 | */ |
|
| 25 | private $container; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * {@inheritdoc} |
|
| 29 | */ |
|
| 30 | public function setUp() |
|
| 31 | { |
|
| 32 | $this->container = $this->prophesize(ContainerInterface::class); |
|
| 33 | ||
| 34 | $worker = $this->prophesize(WorkerInterface::class); |
|
| 35 | $this->container->get(DoctrineWorker::class)->willReturn($worker); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testCallingFactoryReturnsHelperInstance() |
|
| 39 | { |
|
| 40 | $factory = new WorkerHelperFactory(); |
|
| 41 | $this->assertInstanceOf(WorkerHelperFactory::class, $factory); |
|
| 42 | ||
| 43 | $class = $factory($this->container->reveal()); |
|
| 44 | ||
| 45 | $this->assertInstanceOf(WorkerHelper::class, $class); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||