CallbackTokenSpec.php 986 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace spec\Prophecy\Argument\Token;
  3. use PhpSpec\ObjectBehavior;
  4. class CallbackTokenSpec extends ObjectBehavior
  5. {
  6. function let()
  7. {
  8. $this->beConstructedWith('get_class');
  9. }
  10. function it_implements_TokenInterface()
  11. {
  12. $this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
  13. }
  14. function it_is_not_last()
  15. {
  16. $this->shouldNotBeLast();
  17. }
  18. function it_scores_7_if_argument_matches_callback()
  19. {
  20. $this->beConstructedWith(function ($argument) { return 2 === $argument; });
  21. $this->scoreArgument(2)->shouldReturn(7);
  22. }
  23. function it_does_not_scores_if_argument_does_not_match_callback()
  24. {
  25. $this->beConstructedWith(function ($argument) { return 2 === $argument; });
  26. $this->scoreArgument(5)->shouldReturn(false);
  27. }
  28. function its_string_representation_should_tell_that_its_callback()
  29. {
  30. $this->__toString()->shouldReturn('callback()');
  31. }
  32. }