LogicalNotTokenSpec.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. function let(TokenInterface $token)
  8. {
  9. $this->beConstructedWith($token);
  10. }
  11. function it_implements_TokenInterface()
  12. {
  13. $this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
  14. }
  15. function it_holds_originating_token($token)
  16. {
  17. $this->getOriginatingToken()->shouldReturn($token);
  18. }
  19. function it_has_simple_string_representation($token)
  20. {
  21. $token->__toString()->willReturn('value');
  22. $this->__toString()->shouldBe('not(value)');
  23. }
  24. function it_wraps_non_token_argument_into_ExactValueToken()
  25. {
  26. $this->beConstructedWith(5);
  27. $token = $this->getOriginatingToken();
  28. $token->shouldhaveType('Prophecy\Argument\Token\ExactValueToken');
  29. $token->getValue()->shouldBe(5);
  30. }
  31. function it_scores_4_if_preset_token_does_not_match_the_argument($token)
  32. {
  33. $token->scoreArgument('argument')->willReturn(false);
  34. $this->scoreArgument('argument')->shouldBe(4);
  35. }
  36. function it_does_not_score_if_preset_token_matches_argument($token)
  37. {
  38. $token->scoreArgument('argument')->willReturn(5);
  39. $this->scoreArgument('argument')->shouldBe(false);
  40. }
  41. function it_is_last_if_preset_token_is_last($token)
  42. {
  43. $token->isLast()->willReturn(true);
  44. $this->shouldBeLast();
  45. }
  46. function it_is_not_last_if_preset_token_is_not_last($token)
  47. {
  48. $token->isLast()->willReturn(false);
  49. $this->shouldNotBeLast();
  50. }
  51. }