No Description

LogicalNotTokenSpec.php 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace spec\Prophecy\Argument\Token;
  3. use PhpSpec\ObjectBehavior;
  4. use Prophecy\Argument\Token\TokenInterface;
  5. class LogicalNotTokenSpec extends ObjectBehavior
  6. {
  7. /**
  8. * @param \Prophecy\Argument\Token\TokenInterface $token
  9. */
  10. function let($token)
  11. {
  12. $this->beConstructedWith($token);
  13. }
  14. function it_implements_TokenInterface()
  15. {
  16. $this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
  17. }
  18. function it_holds_originating_token($token)
  19. {
  20. $this->getOriginatingToken()->shouldReturn($token);
  21. }
  22. function it_has_simple_string_representation($token)
  23. {
  24. $token->__toString()->willReturn('value');
  25. $this->__toString()->shouldBe('not(value)');
  26. }
  27. function it_wraps_non_token_argument_into_ExactValueToken()
  28. {
  29. $this->beConstructedWith(5);
  30. $token = $this->getOriginatingToken();
  31. $token->shouldhaveType('Prophecy\Argument\Token\ExactValueToken');
  32. $token->getValue()->shouldBe(5);
  33. }
  34. function it_scores_4_if_preset_token_does_not_match_the_argument($token)
  35. {
  36. $token->scoreArgument('argument')->willReturn(false);
  37. $this->scoreArgument('argument')->shouldBe(4);
  38. }
  39. function it_does_not_score_if_preset_token_matches_argument($token)
  40. {
  41. $token->scoreArgument('argument')->willReturn(5);
  42. $this->scoreArgument('argument')->shouldBe(false);
  43. }
  44. function it_is_last_if_preset_token_is_last($token)
  45. {
  46. $token->isLast()->willReturn(true);
  47. $this->shouldBeLast();
  48. }
  49. function it_is_not_last_if_preset_token_is_not_last($token)
  50. {
  51. $token->isLast()->willReturn(false);
  52. $this->shouldNotBeLast();
  53. }
  54. }