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


PHP Presenter\PresenterInterface类代码示例

本文整理汇总了PHP中PhpSpec\Formatter\Presenter\PresenterInterface的典型用法代码示例。如果您正苦于以下问题:PHP PresenterInterface类的具体用法?PHP PresenterInterface怎么用?PHP PresenterInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PresenterInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: let

 function let(PresenterInterface $presenter)
 {
     $presenter->presentValue(Argument::any())->willReturn('val');
     $presenter->presentString(Argument::any())->willReturnArgument();
     $this->beConstructedWith('custom', function () {
     }, $presenter);
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:7,代码来源:CallbackMatcherSpec.php

示例2:

 function it_creates_an_accessing_property_on_non_object_exception(PresenterInterface $presenter)
 {
     $presenter->presentString("{$this->fixture->property}")->shouldBeCalled()->willReturn("\"{$this->fixture->property}\"");
     $fixtureMessage = "Getting property \"{$this->fixture->property}\" on a non-object.";
     $exception = $this->gettingPropertyOnNonObject($this->fixture->property);
     $exception->shouldHaveType('PhpSpec\\Exception\\Wrapper\\SubjectException');
     $exception->getMessage()->shouldBe($fixtureMessage);
 }
开发者ID:qasem2rubik,项目名称:laravel,代码行数:8,代码来源:ExceptionFactorySpec.php

示例3: let

 function let(PresenterInterface $presenter)
 {
     $presenter->presentValue(Argument::any())->will(function ($subject) {
         if (is_array($subject[0])) {
             return 'array';
         }
         if (is_object($subject[0])) {
             return 'object';
         }
         return $subject[0];
     });
     $presenter->presentString(Argument::any())->willReturnArgument();
     $this->beConstructedWith($presenter);
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:14,代码来源:ArrayKeyValueMatcherSpec.php

示例4: let

 function let(PresenterInterface $presenter)
 {
     $presenter->presentString(Argument::type('string'))->willReturnArgument();
     $this->beConstructedWith($presenter);
 }
开发者ID:burimshala,项目名称:numbertowords,代码行数:5,代码来源:StringEndMatcherSpec.php

示例5: let

 function let(PresenterInterface $presenter)
 {
     $presenter->presentValue(Argument::any())->willReturn('countable');
     $presenter->presentString(Argument::any())->willReturnArgument();
     $this->beConstructedWith($presenter);
 }
开发者ID:qasem2rubik,项目名称:laravel,代码行数:6,代码来源:ArrayContainMatcherSpec.php

示例6: negativeMatch

 /**
  * Evaluates negative match.
  *
  * @param string $name
  * @param mixed  $subject
  * @param array  $arguments
  *
  * @throws \PhpSpec\Exception\Example\FailureException
  * @return boolean
  */
 public function negativeMatch($name, $subject, array $arguments)
 {
     $checker = $this->getCheckerName($name);
     if (call_user_func($checker, $subject)) {
         throw new FailureException(sprintf('%s not expected to return %s, but it did.', $this->presenter->presentString(sprintf('%s(%s)', $checker, $this->presenter->presentValue($subject))), $this->presenter->presentValue(true)));
     }
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:17,代码来源:ScalarMatcher.php

示例7: beConstructedWith

 /**
  * @param array $args
  *
  * @throws \PhpSpec\Exception\Wrapper\SubjectException
  */
 public function beConstructedWith($args)
 {
     if (null === $this->classname) {
         throw new SubjectException(sprintf('You can not set object arguments. Behavior subject is %s.', $this->presenter->presentValue(null)));
     }
     $this->beAnInstanceOf($this->classname, $args);
 }
开发者ID:mawaha,项目名称:tracker,代码行数:12,代码来源:WrappedObject.php

示例8: get

 /**
  * @param string $name
  *
  * @return Collaborator
  *
  * @throws \PhpSpec\Exception\Wrapper\CollaboratorException
  */
 public function get($name)
 {
     if (!$this->has($name)) {
         throw new CollaboratorException(sprintf('Collaborator %s not found.', $this->presenter->presentString($name)));
     }
     return $this->collaborators[$name];
 }
开发者ID:BuddhiEash,项目名称:laravel_crm,代码行数:14,代码来源:CollaboratorManager.php

示例9: find

 /**
  * @param $keyword
  * @param $subject
  * @param  array                                               $arguments
  * @return mixed
  * @throws \PhpSpec\Exception\Wrapper\MatcherNotFoundException
  */
 public function find($keyword, $subject, array $arguments)
 {
     foreach ($this->matchers as $matcher) {
         if (true === $matcher->supports($keyword, $subject, $arguments)) {
             return $matcher;
         }
     }
     throw new MatcherNotFoundException(sprintf('No %s(%s) matcher found for %s.', $this->presenter->presentString($keyword), $this->presenter->presentValue($arguments), $this->presenter->presentValue($subject)), $keyword, $subject, $arguments);
 }
开发者ID:burimshala,项目名称:numbertowords,代码行数:16,代码来源:MatcherManager.php

示例10: array

 function it_writes_a_fail_message_for_a_failing_example(Template $template, ExampleEvent $event, Presenter $presenter)
 {
     $event->getTitle()->willReturn(self::EVENT_TITLE);
     $event->getMessage()->willReturn(self::EVENT_MESSAGE);
     $event->getBacktrace()->willReturn(self::$BACKTRACE);
     $event->getException()->willReturn(new \Exception());
     $template->render(Template::DIR . '/Template/ReportFailed.html', array('title' => self::EVENT_TITLE, 'message' => self::EVENT_MESSAGE, 'backtrace' => self::BACKTRACE, 'code' => self::CODE, 'index' => 1, 'specification' => 1))->shouldBeCalled();
     $presenter->presentException(Argument::cetera())->willReturn(self::CODE);
     $this->write(1);
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:10,代码来源:ReportFailedItemSpec.php

示例11: beConstructedWith

 /**
  * @param array $args
  *
  * @throws \PhpSpec\Exception\Wrapper\SubjectException
  */
 public function beConstructedWith($args)
 {
     if (null === $this->classname) {
         throw new SubjectException(sprintf('You can not set object arguments. Behavior subject is %s.', $this->presenter->presentValue(null)));
     }
     if ($this->isInstantiated()) {
         throw new SubjectException('You can not change object construction method when it is already instantiated');
     }
     $this->beAnInstanceOf($this->classname, $args);
 }
开发者ID:ProgrammingPeter,项目名称:nba-schedule-api,代码行数:15,代码来源:WrappedObject.php

示例12: matches

 /**
  * @param mixed $subject
  * @param array $arguments
  *
  * @return boolean
  */
 protected function matches($subject, array $arguments)
 {
     if (!$this->isRestViewObject($subject)) {
         $this->exception = new FailureException(sprintf('Expected %s to be an instance of FOS\\RestBundle\\View\\View', $this->presenter->presentValue($subject)));
         return false;
     }
     /** @var View $subject */
     $argument = isset($arguments[0]) ? $arguments[0] : [];
     if (!$this->dataMatches($subject, $argument)) {
         $this->exception = new FailureException(sprintf('Expected %s to be a data of the View, but it is not. Instead got: %s', $this->presenter->presentValue($argument['data']), $this->presenter->presentValue($subject->getData())));
         return false;
     }
     if (!$this->statusCodeMatches($subject, $argument)) {
         $this->exception = new FailureException(sprintf('Expected %s to be a status code of the View, but it is not. Instead got: %s', $this->presenter->presentValue($argument['statusCode']), $this->presenter->presentValue($subject->getStatusCode())));
         return false;
     }
     if (!$this->headersMatches($subject, $argument)) {
         $this->exception = new FailureException(sprintf('Expected headers to be %s, but it is not. Instead got: %s. Details: %s', $this->presenter->presentValue($argument['headers']), $this->presenter->presentValue($subject->getHeaders()), $this->matcher->getError()));
         return false;
     }
     if (!$this->serializationGroupsMatches($subject, $argument)) {
         $this->exception = new FailureException(sprintf('Expected serialization group to be %s, but they are not', empty($argument['serializationGroups']) ? 'empty (it\'s impossible!)' : implode(', ', $argument['serializationGroups'])));
         return false;
     }
 }
开发者ID:codifico,项目名称:phpspec-rest-view-extension,代码行数:31,代码来源:RestViewMatcher.php

示例13: verifyNegative

 /**
  * @param callable $callable
  * @param array $arguments
  * @param string|null $exception
  *
  * @throws \PhpSpec\Exception\Example\FailureException
  */
 public function verifyNegative($callable, array $arguments, $exception = null)
 {
     try {
         call_user_func_array($callable, $arguments);
     } catch (\Exception $e) {
         if (null === $exception) {
             throw new FailureException(sprintf('Expected to not throw any exceptions, but got %s.', $this->presenter->presentValue($e)));
         }
         if ($e instanceof $exception) {
             $invalidProperties = array();
             if (is_object($exception)) {
                 $exceptionRefl = $this->factory->create($exception);
                 foreach ($exceptionRefl->getProperties() as $property) {
                     if (in_array($property->getName(), self::$ignoredProperties)) {
                         continue;
                     }
                     $property->setAccessible(true);
                     $expected = $property->getValue($exception);
                     $actual = $property->getValue($e);
                     if (null !== $expected && $actual === $expected) {
                         $invalidProperties[] = sprintf('  `%s`=%s', $property->getName(), $this->presenter->presentValue($expected));
                     }
                 }
             }
             $withProperties = '';
             if (count($invalidProperties) > 0) {
                 $withProperties = sprintf(' with' . PHP_EOL . '%s,' . PHP_EOL, implode(",\n", $invalidProperties));
             }
             throw new FailureException(sprintf('Expected to not throw %s exception%s but got it.', $this->presenter->presentValue($exception), $withProperties));
         }
     }
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:39,代码来源:ThrowMatcher.php

示例14: beAnInstanceOf

 /**
  * @param string $classname
  * @param array $arguments
  *
  * @throws \PhpSpec\Exception\Wrapper\SubjectException
  */
 public function beAnInstanceOf($classname, array $arguments = array())
 {
     if (!is_string($classname)) {
         throw new SubjectException(sprintf('Behavior subject classname should be a string, %s given.', $this->presenter->presentValue($classname)));
     }
     $this->classname = $classname;
     $unwrapper = new Unwrapper();
     $this->arguments = $unwrapper->unwrapAll($arguments);
     $this->isInstantiated = false;
     $this->factoryMethod = null;
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:17,代码来源:WrappedObject.php

示例15: negativeMatch

 /**
  * @param string $name
  * @param mixed $subject
  * @param array $arguments
  *
  * @throws \PhpSpec\Exception\Example\FailureException
  * @throws \PhpSpec\Exception\Fracture\MethodNotFoundException
  */
 public function negativeMatch($name, $subject, array $arguments)
 {
     preg_match(self::$regex, $name, $matches);
     $method = ('be' === $matches[1] ? 'is' : 'has') . ucfirst($matches[2]);
     $callable = array($subject, $method);
     if (!method_exists($subject, $method)) {
         throw new MethodNotFoundException(sprintf('Method %s not found.', $this->presenter->presentValue($callable)), $subject, $method, $arguments);
     }
     if (false !== ($result = call_user_func_array($callable, $arguments))) {
         throw $this->getFailureExceptionFor($callable, false, $result);
     }
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:20,代码来源:ObjectStateMatcher.php


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