當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Prophet::checkPredictions方法代碼示例

本文整理匯總了PHP中Prophecy\Prophet::checkPredictions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Prophet::checkPredictions方法的具體用法?PHP Prophet::checkPredictions怎麽用?PHP Prophet::checkPredictions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Prophecy\Prophet的用法示例。


在下文中一共展示了Prophet::checkPredictions方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tearDown

 protected function tearDown()
 {
     if ($this->prophet) {
         $this->prophet->checkPredictions();
     }
     parent::tearDown();
 }
開發者ID:rollerworks,項目名稱:search,代碼行數:7,代碼來源:SearchIntegrationTestCase.php

示例2: Prophet

 function it_should_be_able_to_run_processes()
 {
     $prophet = new Prophet();
     $processes = [];
     for ($i = 0; $i < 20; $i++) {
         $process = $prophet->prophesize(Process::class);
         $process->started = false;
         $process->terminated = false;
         $process->start()->will(function () use($process) {
             $process->started = true;
         })->shouldBeCalledTimes(1);
         $process->isTerminated()->will(function () use($process) {
             if (!$process->terminated) {
                 $process->terminated = true;
                 return false;
             }
             return true;
         })->shouldBeCalledTimes(2);
         // The number of times isStarted() is called starts at 3
         // and increases by 2 after each chunk of five processes.
         $process->isStarted()->will(function () use($process) {
             return $process->started;
         })->shouldBeCalledTimes(floor($i / 5) * 2 + 3);
         $processes[] = $process->reveal();
     }
     $this->run($processes);
     $prophet->checkPredictions();
 }
開發者ID:phpro,項目名稱:grumphp,代碼行數:28,代碼來源:AsyncProcessRunnerSpec.php

示例3: verifyMockObjects

 protected function verifyMockObjects()
 {
     parent::verifyMockObjects();
     if (null === $this->prophet) {
         return;
     }
     try {
         $this->prophet->checkPredictions();
     } catch (\Exception $e) {
         /** Intentionally left empty */
     }
     $this->countProphecyAssertions();
     if (isset($e)) {
         throw $e;
     }
 }
開發者ID:phpspec,項目名稱:prophecy-phpunit,代碼行數:16,代碼來源:ProphecyTestCase.php

示例4: expectingWithoutOptionalParameter

 /**
  * Calling no optional parameter
  *
  * @test
  * @see https://github.com/php-mock/php-mock-prophecy/issues/1
  */
 public function expectingWithoutOptionalParameter()
 {
     $prophet = new Prophet();
     $prophecy = $prophet->prophesize(OptionalParameterHolder::class);
     $prophecy->call("arg1")->willReturn("mocked");
     $mock = $prophecy->reveal();
     $this->assertEquals("mocked", $mock->call("arg1"));
     $prophet->checkPredictions();
 }
開發者ID:php-mock,項目名稱:php-mock-prophecy,代碼行數:15,代碼來源:RegressionTest.php

示例5: verifyMockObjects

 /**
  * {@inheritdoc}
  */
 protected function verifyMockObjects()
 {
     parent::verifyMockObjects();
     if ($this->prophet !== null) {
         try {
             $this->prophet->checkPredictions();
         } catch (\Exception $e) {
             /** Intentionally left empty */
         }
         foreach ($this->prophet->getProphecies() as $objectProphecy) {
             foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) {
                 foreach ($methodProphecies as $methodProphecy) {
                     $this->addToAssertionCount(count($methodProphecy->getCheckedPredictions()));
                 }
             }
         }
         if (isset($e)) {
             throw $e;
         }
     }
 }
開發者ID:Arachnias,項目名稱:FlobFoundationBundle,代碼行數:24,代碼來源:BaseTestCase.php

示例6: testOnNewAccountCreated

 public function testOnNewAccountCreated()
 {
     $userName = 'tester';
     $userEmail = 'tester@example.com';
     $messageBody = 'Body';
     $messageSubject = 'Subject';
     $template = $this->prophet->prophesize('Twig_Template');
     $event = $this->prophet->prophesize('Smoovio\\Bundle\\CoreBundle\\Event\\NewAccountCreatedEvent');
     $user = $this->prophet->prophesize('Smoovio\\Bundle\\CoreBundle\\Entity\\User');
     $this->templating->loadTemplate($this->templateName)->willReturn($template->reveal())->shouldBeCalled();
     $template->renderBlock('subject', [])->willReturn('Subject');
     $event->getUser()->willReturn($user);
     $user->getUsername()->willReturn($userName);
     $user->getEmail()->willReturn($userEmail);
     $template->renderBlock('body', ['username' => $userName])->willReturn($messageBody)->shouldBeCalled();
     $this->mailer->send(Argument::that(function (\Swift_Message $message) use($userEmail, $messageBody, $messageSubject) {
         $this->assertSame($this->sender, $message->getSender());
         $this->assertSame($userEmail, $message->getTo());
         $this->assertSame($messageSubject, $message->getSubject());
         $this->assertSame($messageBody, $message->getBody());
     }));
     $this->listener->onNewAccountCreated($event->reveal());
     $this->prophet->checkPredictions();
 }
開發者ID:nicolas-grekas,項目名稱:workshop-symfony3,代碼行數:24,代碼來源:SendConfirmationMailListenerTest.php

示例7: testManagerCreatesUserSuccessfulWithProphecy

 public function testManagerCreatesUserSuccessfulWithProphecy()
 {
     $prophet = new Prophet();
     $manager = $prophet->prophesize('Doctrine\\Common\\Persistence\\ObjectManager');
     $encoderFactory = $prophet->prophesize('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface');
     $encoder = $prophet->prophesize('Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface');
     $dispatcher = $prophet->prophesize('Symfony\\Component\\Eventdispatcher\\EventDispatcherInterface');
     $user = $prophet->prophesize('Smoovio\\Bundle\\CoreBundle\\Entity\\User');
     $encoderFactory->getEncoder($user->reveal())->willReturn($encoder)->shouldBeCalled();
     $user->encodePassword($encoder->reveal())->shouldBeCalled();
     $manager->persist($user)->shouldBeCalled();
     $manager->flush()->shouldBeCalled();
     $dispatcher->dispatch(CoreEvents::NEW_ACCOUNT_CREATED, Argument::that(function ($event) use($user) {
         return $event instanceof NewAccountCreatedEvent && $event->getUser() === $user;
     }));
     $userManager = new UserManager($manager->reveal(), $encoderFactory->reveal(), $dispatcher->reveal());
     $userManager->createUser($user->reveal());
     $prophet->checkPredictions();
 }
開發者ID:nicolas-grekas,項目名稱:workshop-symfony3,代碼行數:19,代碼來源:UserManagerTest.php

示例8: array

 function it_should_return_messages_to_given_recipient(ConnectionInterface $connection, ArrayToMessageTransformer $messageTransformer)
 {
     $rawMessages = array(array('id' => 4, 'recipients' => array('john.doe@example.com')), array('id' => 2, 'recipients' => array('demo@example.com', 'john.doe@example.com')), array('id' => 1, 'recipients' => array('john@example.com')));
     $prophet = new Prophet();
     $mockMessages = array($prophet->prophesize('Kibao\\MailCatcher\\Message\\MessageInterface'), $prophet->prophesize('Kibao\\MailCatcher\\Message\\MessageInterface'), $prophet->prophesize('Kibao\\MailCatcher\\Message\\MessageInterface'));
     for ($i = 0; $i < 3; $i++) {
         $rawMessage = $rawMessages[$i];
         $recipients = array();
         foreach ($rawMessage['recipients'] as $email) {
             $recipient = $prophet->prophesize('Kibao\\MailCatcher\\Address\\AddressInterface');
             $recipient->getEmail()->willReturn($email);
             $recipients[] = $recipient;
         }
         $mockMessages[$i]->getRecipients()->willReturn($recipients);
         $messageTransformer->transform($rawMessage)->willReturn($mockMessages[$i]);
         $connection->getMessage($rawMessage['id'])->willReturn($rawMessage);
     }
     $connection->getMessages()->willReturn($rawMessages);
     $this->getMessagesTo('john.doe@example.com')->shouldReturn(array($mockMessages[0], $mockMessages[1]));
     $prophet->checkPredictions();
 }
開發者ID:kibao,項目名稱:mailcatcher,代碼行數:21,代碼來源:ClientSpec.php

示例9: verifyMockObjects

 /**
  * Verifies the mock object expectations.
  *
  * @since Method available since Release 3.5.0
  */
 protected function verifyMockObjects()
 {
     foreach ($this->mockObjects as $mockObject) {
         if ($mockObject->__phpunit_hasMatchers()) {
             $this->numAssertions++;
         }
         $mockObject->__phpunit_verify();
     }
     if ($this->prophet !== null) {
         try {
             $this->prophet->checkPredictions();
         } catch (Exception $e) {
             /** Intentionally left empty */
         }
         foreach ($this->prophet->getProphecies() as $objectProphecy) {
             foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) {
                 foreach ($methodProphecies as $methodProphecy) {
                     $this->numAssertions += count($methodProphecy->getCheckedPredictions());
                 }
             }
         }
         if (isset($e)) {
             throw $e;
         }
     }
 }
開發者ID:emsdog,項目名稱:lumen-todo,代碼行數:31,代碼來源:TestCase.php

示例10: tearDown

 public function tearDown()
 {
     $this->prophet->checkPredictions();
 }
開發者ID:rawebone,項目名稱:micro,代碼行數:4,代碼來源:TestCase.php

示例11: teardown

 /**
  * @param ExampleNode            $example
  * @param SpecificationInterface $context
  * @param MatcherManager         $matchers
  * @param CollaboratorManager    $collaborators
  */
 public function teardown(ExampleNode $example, SpecificationInterface $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     $this->prophet->checkPredictions();
 }
開發者ID:ProgrammingPeter,項目名稱:nba-schedule-api,代碼行數:10,代碼來源:CollaboratorsMaintainer.php

示例12: letgo

 public function letgo()
 {
     $this->prophet->checkPredictions();
 }
開發者ID:bcen,項目名稱:silex-dispatcher,代碼行數:4,代碼來源:DeserializerSpec.php

示例13: tearDown

 protected function tearDown()
 {
     $prophet = new Prophet();
     $prophet->checkPredictions();
 }
開發者ID:kpicaza,項目名稱:ChistesApp,代碼行數:5,代碼來源:JokeRepositoryTest.php

示例14: tearDown

 /**
  * {@inheridoc}.
  */
 protected function tearDown()
 {
     $this->prophet->checkPredictions();
 }
開發者ID:shokohsc,項目名稱:TwitchApiBundle,代碼行數:7,代碼來源:MeRepositoryTest.php

示例15: assertPostConditions

 protected function assertPostConditions()
 {
     if ($this->prophet) {
         $this->prophet->checkPredictions();
     }
 }
開發者ID:Edencia,項目名稱:orientdb-php-odm,代碼行數:6,代碼來源:TestCase.php


注:本文中的Prophecy\Prophet::checkPredictions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。