Drupal investigation

ArgumentSpec.php 3.4KB

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