本文整理匯總了PHP中PhpSpec\Formatter\Presenter\PresenterInterface::presentString方法的典型用法代碼示例。如果您正苦於以下問題:PHP PresenterInterface::presentString方法的具體用法?PHP PresenterInterface::presentString怎麽用?PHP PresenterInterface::presentString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PhpSpec\Formatter\Presenter\PresenterInterface
的用法示例。
在下文中一共展示了PresenterInterface::presentString方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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)));
}
}
示例2: 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];
}
示例3: 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);
}
示例4: let
function let(PresenterInterface $presenter)
{
$presenter->presentValue(Argument::any())->willReturn('val');
$presenter->presentString(Argument::any())->willReturnArgument();
$this->beConstructedWith('custom', function () {
}, $presenter);
}
示例5:
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);
}
示例6: 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);
}
示例7: let
function let(PresenterInterface $presenter)
{
$presenter->presentString(Argument::type('string'))->willReturnArgument();
$this->beConstructedWith($presenter);
}
示例8: getNegativeFailureException
/**
* @param string $name
* @param mixed $subject
* @param array $arguments
*
* @return FailureException
*/
protected function getNegativeFailureException($name, $subject, array $arguments)
{
return new FailureException(sprintf('Expected %s not to match %s regex, but it does.', $this->presenter->presentString($subject), $this->presenter->presentString($arguments[0])));
}
示例9: let
function let(PresenterInterface $presenter)
{
$presenter->presentValue(Argument::any())->willReturn('countable');
$presenter->presentString(Argument::any())->willReturnArgument();
$this->beConstructedWith($presenter);
}
示例10: gettingPropertyOnNonObject
/**
* @param string $property
*
* @return SubjectException
*/
public function gettingPropertyOnNonObject($property)
{
return new SubjectException(sprintf('Getting property %s on a non-object.', $this->presenter->presentString($property)));
}
示例11: getNegativeFailureException
/**
* @param string $name
* @param mixed $subject
* @param array $arguments
*
* @return FailureException
*/
protected function getNegativeFailureException($name, $subject, array $arguments)
{
return new FailureException(sprintf('%s not expected to %s(%s), but it did.', $this->presenter->presentValue($subject), $this->presenter->presentString($name), implode(', ', array_map(array($this->presenter, 'presentValue'), $arguments))));
}
示例12: interfaceNotImplemented
/**
* @return InterfaceNotImplementedException
*/
private function interfaceNotImplemented()
{
return new InterfaceNotImplementedException(sprintf('%s does not implement %s interface, but should.', $this->presenter->presentValue($this->caller->getWrappedObject()), $this->presenter->presentString('ArrayAccess')), $this->caller->getWrappedObject(), 'ArrayAccess');
}
示例13: getNegativeFailureException
/**
* @param string $name
* @param mixed $subject
* @param array $arguments
*
* @return FailureException
*/
protected function getNegativeFailureException($name, $subject, array $arguments)
{
return new FailureException(sprintf('Did not expect instance of %s, but got %s.', $this->presenter->presentString($arguments[0]), $this->presenter->presentValue($subject)));
}
示例14: getNegativeFailureException
/**
* @param string $name
* @param mixed $subject
* @param array $arguments
*
* @return FailureException
*/
protected function getNegativeFailureException($name, $subject, array $arguments)
{
return new FailureException(sprintf('Expected %s not to have %s items, but got it.', $this->presenter->presentValue($subject), $this->presenter->presentString(intval($arguments[0]))));
}