/** @test */ public function it_should_not_call_remove_from_indices_if_afterUpdate_is_set_to_false() { $dummyModel = new DummyActiveRecordModel(); $dummyModel->attachBehavior('test', ['class' => SynchronousAutoIndexBehavior::class, 'afterUpdate' => false]); $this->dummyAlgoliaManager->shouldNotReceive('updateInIndices'); $dummyModel->trigger(ActiveRecord::EVENT_AFTER_UPDATE); }
/** * @test */ public function it_discards_messages_that_where_captured_when_a_exception_occured() { $this->capturer->shouldReceive('clear')->withNoArgs()->once(); $this->capturer->shouldNotReceive('fetchMessages'); $this->setExpectedException(\RuntimeException::class, 'Failed'); $this->middleware->execute('some_command', function () { throw new \RuntimeException('Failed'); }); }
/** * @test */ public function it_should_pass_trough_none_rpc_commands() { $this->transformer->shouldNotReceive('transformCommandResponse'); $this->publisher->shouldNotReceive('publish'); $envelope = Mockery::mock(\AMQPEnvelope::class); $envelope->shouldReceive('getReplyTo')->atLeast()->once()->andReturn(''); $command = Mockery::mock(Command::class); $command->shouldReceive('getEnvelope')->atLeast()->once()->andReturn($envelope); $this->execute($this->middleware, $command, $command); }
/** * @test */ public function it_should_reject_a_envelope_when_there_is_a_exception() { $middleware = new ConsumeMiddleware(false); $this->queue->shouldNotReceive('ack')->with('tag'); $this->queue->shouldReceive('reject')->once()->with('tag', AMQP_NOPARAM); $this->envelope->shouldReceive('getDeliveryTag')->withNoArgs()->andReturn('tag'); $this->setExpectedException(\RuntimeException::class, 'The queue should reject the message now'); $middleware->execute($this->command, function () { throw new \RuntimeException('The queue should reject the message now'); }); }
public function testDoNotProcessWhenTacticianDoctrineIsNotInstalled() { if (class_exists(TransactionMiddleware::class)) { $this->markTestSkipped('"league/tactician-doctrine" is installed'); } $this->container->shouldReceive('hasParameter')->with('doctrine.entity_managers')->andReturn(true); $this->container->shouldNotReceive('getParameter')->withAnyArgs(); $this->container->shouldNotReceive('setDefinition')->withAnyArgs(); $this->container->shouldNotReceive('setAlias')->withAnyArgs(); $this->compiler->process($this->container); }
public function testRolloverWithoutCourseObjectives() { $course = $this->createTestCourse(); $course->setSchool(new School()); $course->addObjective(new Objective()); $newCourse = m::mock('Ilios\\CoreBundle\\Entity\\CourseInterface'); $newCourse->shouldIgnoreMissing(); $newCourse->shouldNotReceive('addObjective'); $this->objectiveManager->shouldNotReceive('create'); $newYear = $this->setupCourseManager($course, $newCourse); $this->service->rolloverCourse($course->getId(), $newYear, ['skip-course-objectives' => true]); }
/** * @test */ public function it_should_continue_if_its_not_a_message() { $this->locator->shouldNotReceive('getPublisherForMessage'); $command = new \stdClass(); $this->execute($this->middleware, $command, $command); }
/** * @test */ public function it_should_pass_trough_unknown_commands() { $this->transformer->shouldNotReceive('transformCommandToMessage'); $command = new \stdClass(); $this->execute($this->middleware, $command, $command); }
/** * @test */ public function it_should_pass_trough_none_amqp_commands() { $this->transformer->shouldNotReceive('transformEnvelopeToCommand'); $command = new \stdClass(); $this->execute($this->middleware, $command, $command); }