当前位置: 首页>>代码示例>>PHP>>正文


PHP MockInterface::shouldIgnoreMissing方法代码示例

本文整理汇总了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();
 }
开发者ID:prasol,项目名称:socialrest,代码行数:8,代码来源:FriendsControllerTest.php

示例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]);
 }
开发者ID:priestd09,项目名称:dispatcher,代码行数:11,代码来源:TestScheduleInterpreter.php

示例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;
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:16,代码来源:MockStripe.php

示例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;
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:16,代码来源:MockPayPal.php

示例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);
 }
开发者ID:RonRademaker,项目名称:tactician-logger,代码行数:12,代码来源:LoggerMiddlewareTest.php

示例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);
 }
开发者ID:priestd09,项目名称:dispatcher,代码行数:12,代码来源:TestScheduleService.php

示例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();
 }
开发者ID:fortrabbit,项目名称:beelzebub,代码行数:13,代码来源:DaemonTest.php

示例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);
 }
开发者ID:prasol,项目名称:socialrest,代码行数:14,代码来源:FollowersControllerTest.php

示例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();
 }
开发者ID:dlundgren,项目名称:atc,代码行数:15,代码来源:DispatchTest.php

示例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();
 }
开发者ID:tailwindsllc,项目名称:modus,代码行数:10,代码来源:BootstrapTest.php

示例11: testAddRecordWhereRequiredFieldIsMissing

 /**
  * @expectedException \Giftcards\FixedWidth\FieldRequiredException
  */
 public function testAddRecordWhereRequiredFieldIsMissing()
 {
     $this->formatter->shouldIgnoreMissing();
     $this->builder->addRecord('record1', array('field1' => 3));
 }
开发者ID:SaveYa,项目名称:FixedWidth,代码行数:8,代码来源:FileBuilderTest.php

示例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);
 }
开发者ID:stopfstedt,项目名称:ilios,代码行数:88,代码来源:CourseRolloverTest.php


注:本文中的Mockery\MockInterface::shouldIgnoreMissing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。