StringContainsTokenSpec.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace spec\Prophecy\Argument\Token;
  3. use PhpSpec\ObjectBehavior;
  4. use Prophecy\Argument;
  5. class StringContainsTokenSpec extends ObjectBehavior
  6. {
  7. function let()
  8. {
  9. $this->beConstructedWith('a substring');
  10. }
  11. function it_is_initializable()
  12. {
  13. $this->shouldHaveType('Prophecy\Argument\Token\StringContainsToken');
  14. }
  15. function it_implements_TokenInterface()
  16. {
  17. $this->shouldBeAnInstanceOf('Prophecy\Argument\Token\TokenInterface');
  18. }
  19. function it_holds_value()
  20. {
  21. $this->getValue()->shouldReturn('a substring');
  22. }
  23. function it_is_not_last()
  24. {
  25. $this->shouldNotBeLast();
  26. }
  27. function it_scores_6_if_the_argument_contains_the_value()
  28. {
  29. $this->scoreArgument('Argument containing a substring')->shouldReturn(6);
  30. }
  31. function it_does_not_score_if_the_argument_does_not_contain_the_value()
  32. {
  33. $this->scoreArgument('Argument will not match')->shouldReturn(false);
  34. }
  35. function its_string_representation_shows_substring()
  36. {
  37. $this->__toString()->shouldReturn('contains("a substring")');
  38. }
  39. }