本文整理汇总了PHP中Mockery\MockInterface::shouldIgnoreMissing方法的典型用法代码示例。如果您正苦于以下问题:PHP MockInterface::shouldIgnoreMissing方法的具体用法?PHP MockInterface::shouldIgnoreMissing怎么用?PHP MockInterface::shouldIgnoreMissing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mockery\MockInterface
的用法示例。
在下文中一共展示了MockInterface::shouldIgnoreMissing方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLevelValidation
public function testLevelValidation()
{
$this->userMock->shouldIgnoreMissing();
$this->action('GET', $this->controller . '@index', [], ['level' => 'invalid']);
$this->assertResponseStatus(HttpResponse::HTTP_UNPROCESSABLE_ENTITY);
$this->action('GET', $this->controller . '@index', [], ['level' => 1]);
$this->assertResponseOk();
}
示例2: setUp
public function setUp()
{
parent::setUp();
$this->carbon = m::mock('Carbon\\Carbon');
$this->carbon->shouldIgnoreMissing();
$this->cronExpression = m::mock('Cron\\CronExpression');
$this->app->instance('Cron\\CronExpression', $this->cronExpression);
$this->scheduler = m::mock('Indatus\\Dispatcher\\Drivers\\DateTime\\Scheduler');
$this->scheduler->shouldIgnoreMissing();
$this->interpreter = m::mock('Indatus\\Dispatcher\\Drivers\\DateTime\\ScheduleInterpreter[]', [$this->scheduler, $this->carbon]);
}
示例3: mockStripeCharge
/**
* @throws \InvalidArgumentException
*
* @return MockInterface
*/
private function mockStripeCharge() : MockInterface
{
if ($this->mockStripeCharge === null) {
$this->mockStripeCharge = Mockery::mock(Charge::class);
$this->mockStripeCharge->shouldIgnoreMissing()->asUndefined();
app()->extend(Charge::class, function () {
return $this->mockStripeCharge;
});
}
return $this->mockStripeCharge;
}
示例4: mockPayPalPayment
/**
* @throws \InvalidArgumentException
*
* @return Payment|MockInterface
*/
private function mockPayPalPayment()
{
if ($this->payPalPayment === null) {
$this->payPalPayment = Mockery::mock(Payment::class);
$this->payPalPayment->shouldIgnoreMissing()->asUndefined();
app()->extend(Payment::class, function () {
return $this->payPalPayment;
});
}
return $this->payPalPayment;
}
示例5: testNextCallableIsInvoked
public function testNextCallableIsInvoked()
{
$this->logger->shouldIgnoreMissing();
$this->formatter->shouldIgnoreMissing();
$sentCommand = new RegisterUserCommand();
$receivedSameCommand = false;
$next = function ($receivedCommand) use(&$receivedSameCommand, $sentCommand) {
$receivedSameCommand = $receivedCommand === $sentCommand;
};
$this->middleware->execute($sentCommand, $next);
$this->assertTrue($receivedSameCommand);
}
示例6: setUp
public function setUp()
{
parent::setUp();
$this->scheduler = App::make('Indatus\\Dispatcher\\Drivers\\DateTime\\Scheduler');
$this->interpreter = m::mock('Indatus\\Dispatcher\\Drivers\\DateTime\\ScheduleInterpreter');
$this->interpreter->shouldIgnoreMissing(false);
$this->app->instance('Indatus\\Dispatcher\\Drivers\\DateTime\\ScheduleInterpreter', $this->interpreter);
$this->logger = m::mock('Illuminate\\Contracts\\Logging\\Log');
$this->app->instance('Illuminate\\Contracts\\Logging\\Log', $this->logger);
$this->console = m::mock('Illuminate\\Contracts\\Console\\Kernel');
$this->scheduleService = new ScheduleService($this->console);
}
示例7: setUp
public function setUp()
{
$this->logger = m::mock('\\Monolog\\Logger');
$this->logger->shouldIgnoreMissing();
$this->manager = m::mock('\\Spork\\ProcessManager');
$this->manager->shouldReceive('wait')->atLeast(1);
$this->events = m::mock('\\Symfony\\Component\\EventDispatcher\\EventDispatcher');
//$this->events->shouldReceive('dispatch')->zeroOrMoreTimes();
$this->pcntl = test::double('Beelzebub\\Wrapper\\Pcntl', array('signal' => true));
$this->posix = $this->getPosixDouble();
$this->builtin = test::double('Beelzebub\\Wrapper\\Builtin', array('doExit' => null, 'doUsleep' => null));
parent::setUp();
}
示例8: testAddFollowerValidation
public function testAddFollowerValidation()
{
$this->userMock->shouldIgnoreMissing();
$this->action('POST', $this->controller . '@store');
$this->assertResponseStatus(HttpResponse::HTTP_UNPROCESSABLE_ENTITY);
$this->action('POST', $this->controller . '@store', ['userId' => 'invalid']);
$this->assertResponseStatus(HttpResponse::HTTP_UNPROCESSABLE_ENTITY);
$this->followingMock->shouldReceive('loadUsers')->once()->andReturn(false);
$this->action('POST', $this->controller . '@store', ['userId' => -1]);
$this->assertResponseStatus(HttpResponse::HTTP_UNPROCESSABLE_ENTITY);
$this->followingMock->shouldReceive('loadUsers')->once()->andReturn(true)->shouldReceive('isLinked')->once()->andReturn(true);
$this->action('POST', $this->controller . '@store', ['userId' => 0]);
$this->assertResponseStatus(HttpResponse::HTTP_UNPROCESSABLE_ENTITY);
}
示例9: setUpTestRun
private function setUpTestRun($case)
{
// Matcher
$this->router->shouldReceive('match')->once()->withAnyArgs()->andReturn($case['route']);
// Request
$this->request->shouldIgnoreMissing();
$this->request->server = $this->getBag('ServerBag');
$this->request->server->shouldIgnoreMissing([]);
$this->presenter->shouldReceive('getAvailableFormats')->once()->withNoArgs()->andReturn($case['formats']);
$this->action_factory->shouldReceive('newInstance')->once()->withAnyArgs()->andReturn($case['action']);
$this->event_dispatcher->shouldReceive('dispatch')->once()->with(DispatchEvents::PRE_DISPATCH, \Mockery::any())->andReturnNull();
$this->event_dispatcher->shouldReceive('dispatch')->with(DispatchEvents::POST_DISPATCH, \Mockery::any())->andReturnNull();
$this->event_dispatcher->shouldReceive('dispatch')->with(DispatchEvents::PRE_PRESENT, \Mockery::any())->andReturnNull();
$this->event_dispatcher->shouldReceive('dispatch')->with(DispatchEvents::POST_PRESENT, \Mockery::any())->andReturnNull();
}
示例10: testNotFoundNoErrorPageThrowsException
/**
* @expectedException Modus\Common\Route\Exception\NotFoundException
*/
public function testNotFoundNoErrorPageThrowsException()
{
$this->router->shouldReceive('determineRouting')->once()->andReturn(false);
$this->router->shouldIgnoreMissing();
$this->config->shouldReceive('getConfig')->andReturn([]);
$this->bootstrap->execute();
}
示例11: testAddRecordWhereRequiredFieldIsMissing
/**
* @expectedException \Giftcards\FixedWidth\FieldRequiredException
*/
public function testAddRecordWhereRequiredFieldIsMissing()
{
$this->formatter->shouldIgnoreMissing();
$this->builder->addRecord('record1', array('field1' => 3));
}
示例12: testRolloverInSameYearKeepsRelationships
public function testRolloverInSameYearKeepsRelationships()
{
$course = $this->createTestCourseWithAssociations();
$newCourse = m::mock('Ilios\\CoreBundle\\Entity\\CourseInterface');
$newYear = $course->getYear();
$newTitle = $course->getTitle() . ' again';
$this->courseManager->shouldReceive('findOneBy')->withArgs([['id' => $course->getId()]])->andReturn($course)->once();
$this->courseManager->shouldReceive('findBy')->withArgs([['title' => $newTitle, 'year' => $newYear]])->andReturn(false)->once();
$this->courseManager->shouldReceive('update')->withArgs([$newCourse, false, false])->once();
$this->courseManager->shouldReceive('create')->once()->andReturn($newCourse);
$this->courseManager->shouldReceive('flushAndClear')->once();
$newCourse->shouldReceive()->setCohorts()->with($course->getCohorts());
$newCourse->shouldIgnoreMissing();
foreach ($course->getObjectives() as $objective) {
$newObjective = m::mock('Ilios\\CoreBundle\\Entity\\Objective');
$newObjective->shouldReceive('setTitle')->with($objective->getTitle())->once();
$newObjective->shouldReceive('addCourse')->with($newCourse)->once();
$newObjective->shouldReceive('setMeshDescriptors')->with($objective->getMeshDescriptors())->once();
$newObjective->shouldReceive('setParents')->with($objective->getParents());
$this->objectiveManager->shouldReceive('create')->once()->andReturn($newObjective);
$this->objectiveManager->shouldReceive('update')->once()->withArgs([$newObjective, false, false]);
}
foreach ($course->getLearningMaterials() as $learningMaterial) {
$newLearningMaterial = m::mock('Ilios\\CoreBundle\\Entity\\CourseLearningMaterial');
$newLearningMaterial->shouldIgnoreMissing();
$this->courseLearningMaterialManager->shouldReceive('create')->once()->andReturn($newLearningMaterial);
$this->courseLearningMaterialManager->shouldIgnoreMissing();
}
foreach ($course->getSessions() as $session) {
$newSession = m::mock('Ilios\\CoreBundle\\Entity\\Session');
$newSession->shouldIgnoreMissing();
$this->sessionManager->shouldReceive('create')->once()->andReturn($newSession);
$this->sessionManager->shouldReceive('update')->withArgs([$newSession, false, false])->once();
foreach ($session->getObjectives() as $objective) {
$newObjective = m::mock('Ilios\\CoreBundle\\Entity\\Objective');
$newObjective->shouldIgnoreMissing();
$this->objectiveManager->shouldReceive('create')->once()->andReturn($newObjective);
$this->objectiveManager->shouldIgnoreMissing();
}
foreach ($session->getLearningMaterials() as $learningMaterial) {
$newLearningMaterial = m::mock('Ilios\\CoreBundle\\Entity\\SessionLearningMaterial');
$newLearningMaterial->shouldIgnoreMissing();
$this->sessionLearningMaterialManager->shouldReceive('create')->once()->andReturn($newLearningMaterial);
$this->sessionLearningMaterialManager->shouldIgnoreMissing();
}
if ($oldDescription = $session->getSessionDescription()) {
$newDescription = m::mock('Ilios\\CoreBundle\\Entity\\SessionDescriptionInterface');
$newDescription->shouldReceive('setDescription')->with($oldDescription->getDescription())->once();
$newSession->shouldReceive('setSessionDescription')->with($newDescription)->once();
$this->sessionDescriptionManager->shouldReceive('create')->once()->andReturn($newDescription);
$this->sessionDescriptionManager->shouldReceive('update')->once()->withArgs([$newDescription, false, false]);
}
if ($oldIlmSession = $session->getIlmSession()) {
$newIlmSession = m::mock('Ilios\\CoreBundle\\Entity\\IlmSessionInterface');
$newIlmSession->shouldReceive('setHours')->with($oldIlmSession->getHours())->once();
$newIlmSession->shouldReceive('setDueDate')->with(m::on(function (DateTime $newDueDate) use($oldIlmSession) {
$oldDueDate = $oldIlmSession->getDueDate();
return $oldDueDate->format('w') === $newDueDate->format('w') && $oldDueDate->format('W') === $newDueDate->format('W');
}))->once();
$newSession->shouldReceive('setIlmSession')->with($newIlmSession)->once();
$this->ilmSessionManager->shouldReceive('create')->once()->andReturn($newIlmSession);
$this->ilmSessionManager->shouldReceive('update')->once()->withArgs([$newIlmSession, false, false]);
}
foreach ($session->getOfferings() as $offering) {
$newOffering = m::mock('Ilios\\CoreBundle\\Entity\\Offering');
$newOffering->shouldReceive('setRoom')->once()->with($offering->getRoom());
$newOffering->shouldReceive('setSite')->once()->with($offering->getSite());
$newOffering->shouldReceive('setStartDate')->with(m::on(function (DateTime $newStart) use($offering) {
$oldStart = $offering->getStartDate();
return $oldStart->format('w') === $newStart->format('w') && $oldStart->format('W') === $newStart->format('W');
}))->once();
$newOffering->shouldReceive('setEndDate')->with(m::on(function (DateTime $newEnd) use($offering) {
$oldEnd = $offering->getEndDate();
return $oldEnd->format('w') === $newEnd->format('w') && $oldEnd->format('W') === $newEnd->format('W');
}))->once();
$newOffering->shouldReceive('setSession')->once()->with($newSession);
$newOffering->shouldReceive('setInstructors')->once()->with($offering->getInstructors());
$newOffering->shouldReceive('setInstructorGroups')->once()->with($offering->getInstructorGroups());
$newOffering->shouldNotReceive('setLearnerGroups');
$newOffering->shouldNotReceive('setLearners');
$this->offeringManager->shouldReceive('create')->once()->andReturn($newOffering);
$this->offeringManager->shouldReceive('update')->once()->withArgs([$newOffering, false, false]);
}
}
$this->objectiveManager->shouldIgnoreMissing();
$rhett = $this->service->rolloverCourse($course->getId(), $newYear, ['new-course-title' => $newTitle]);
$this->assertSame($newCourse, $rhett);
}