|
@@ 50-64 (lines=15) @@
|
| 47 |
|
$this->scoreArguments(array())->shouldReturn(1); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
function it_should_return_match_score_based_on_all_tokens_score( |
| 51 |
|
TokenInterface $token1, |
| 52 |
|
TokenInterface $token2, |
| 53 |
|
TokenInterface $token3 |
| 54 |
|
) { |
| 55 |
|
$token1->scoreArgument('one')->willReturn(3); |
| 56 |
|
$token1->isLast()->willReturn(false); |
| 57 |
|
$token2->scoreArgument(2)->willReturn(5); |
| 58 |
|
$token2->isLast()->willReturn(false); |
| 59 |
|
$token3->scoreArgument($obj = new \stdClass())->willReturn(10); |
| 60 |
|
$token3->isLast()->willReturn(false); |
| 61 |
|
|
| 62 |
|
$this->beConstructedWith(array($token1, $token2, $token3)); |
| 63 |
|
$this->scoreArguments(array('one', 2, $obj))->shouldReturn(18); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
function it_returns_false_if_there_is_less_arguments_than_tokens( |
| 67 |
|
TokenInterface $token1, |
|
@@ 82-96 (lines=15) @@
|
| 79 |
|
$this->scoreArguments(array('one', 2))->shouldReturn(false); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
function it_returns_false_if_there_is_less_tokens_than_arguments( |
| 83 |
|
TokenInterface $token1, |
| 84 |
|
TokenInterface $token2, |
| 85 |
|
TokenInterface $token3 |
| 86 |
|
) { |
| 87 |
|
$token1->scoreArgument('one')->willReturn(3); |
| 88 |
|
$token1->isLast()->willReturn(false); |
| 89 |
|
$token2->scoreArgument(2)->willReturn(5); |
| 90 |
|
$token2->isLast()->willReturn(false); |
| 91 |
|
$token3->scoreArgument($obj = new \stdClass())->willReturn(10); |
| 92 |
|
$token3->isLast()->willReturn(false); |
| 93 |
|
|
| 94 |
|
$this->beConstructedWith(array($token1, $token2, $token3)); |
| 95 |
|
$this->scoreArguments(array('one', 2, $obj, 4))->shouldReturn(false); |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
function it_should_return_false_if_one_of_the_tokens_returns_false( |
| 99 |
|
TokenInterface $token1, |
|
@@ 114-130 (lines=17) @@
|
| 111 |
|
$this->scoreArguments(array('one', 2, $obj))->shouldReturn(false); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
function it_should_calculate_score_until_last_token( |
| 115 |
|
TokenInterface $token1, |
| 116 |
|
TokenInterface $token2, |
| 117 |
|
TokenInterface $token3 |
| 118 |
|
) { |
| 119 |
|
$token1->scoreArgument('one')->willReturn(3); |
| 120 |
|
$token1->isLast()->willReturn(false); |
| 121 |
|
|
| 122 |
|
$token2->scoreArgument(2)->willReturn(7); |
| 123 |
|
$token2->isLast()->willReturn(true); |
| 124 |
|
|
| 125 |
|
$token3->scoreArgument($obj = new \stdClass())->willReturn(10); |
| 126 |
|
$token3->isLast()->willReturn(false); |
| 127 |
|
|
| 128 |
|
$this->beConstructedWith(array($token1, $token2, $token3)); |
| 129 |
|
$this->scoreArguments(array('one', 2, $obj))->shouldReturn(10); |
| 130 |
|
} |
| 131 |
|
} |
| 132 |
|
|