ArgumentSpec.php (3238B)
1 <?php 2 3 namespace spec\Prophecy; 4 5 use PhpSpec\ObjectBehavior; 6 7 class ArgumentSpec extends ObjectBehavior 8 { 9 function it_has_a_shortcut_for_exact_argument_token() 10 { 11 $token = $this->exact(42); 12 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\ExactValueToken'); 13 $token->getValue()->shouldReturn(42); 14 } 15 16 function it_has_a_shortcut_for_any_argument_token() 17 { 18 $token = $this->any(); 19 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\AnyValueToken'); 20 } 21 22 function it_has_a_shortcut_for_multiple_arguments_token() 23 { 24 $token = $this->cetera(); 25 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\AnyValuesToken'); 26 } 27 28 function it_has_a_shortcut_for_type_token() 29 { 30 $token = $this->type('integer'); 31 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\TypeToken'); 32 } 33 34 function it_has_a_shortcut_for_callback_token() 35 { 36 $token = $this->that('get_class'); 37 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\CallbackToken'); 38 } 39 40 function it_has_a_shortcut_for_object_state_token() 41 { 42 $token = $this->which('getName', 'everzet'); 43 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\ObjectStateToken'); 44 } 45 46 function it_has_a_shortcut_for_logical_and_token() 47 { 48 $token = $this->allOf('integer', 5); 49 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\LogicalAndToken'); 50 } 51 52 function it_has_a_shortcut_for_array_count_token() 53 { 54 $token = $this->size(5); 55 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\ArrayCountToken'); 56 } 57 58 function it_has_a_shortcut_for_array_entry_token() 59 { 60 $token = $this->withEntry('key', 'value'); 61 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\ArrayEntryToken'); 62 } 63 64 function it_has_a_shortcut_for_array_every_entry_token() 65 { 66 $token = $this->withEveryEntry('value'); 67 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\ArrayEveryEntryToken'); 68 } 69 70 function it_has_a_shortcut_for_identical_value_token() 71 { 72 $token = $this->is('value'); 73 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\IdenticalValueToken'); 74 } 75 76 function it_has_a_shortcut_for_array_entry_token_matching_any_key() 77 { 78 $token = $this->containing('value'); 79 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\ArrayEntryToken'); 80 $token->getKey()->shouldHaveType('Prophecy\Argument\Token\AnyValueToken'); 81 } 82 83 function it_has_a_shortcut_for_array_entry_token_matching_any_value() 84 { 85 $token = $this->withKey('key'); 86 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\ArrayEntryToken'); 87 $token->getValue()->shouldHaveType('Prophecy\Argument\Token\AnyValueToken'); 88 } 89 90 function it_has_a_shortcut_for_logical_not_token() 91 { 92 $token = $this->not('kagux'); 93 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\LogicalNotToken'); 94 } 95 96 function it_has_a_shortcut_for_string_contains_token() 97 { 98 $token = $this->containingString('string'); 99 $token->shouldBeAnInstanceOf('Prophecy\Argument\Token\StringContainsToken'); 100 } 101 }