yay_convenience.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <?php
  2. /*
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /**
  15. * Provides non-namespaced classes and functions for brevity.
  16. * Including this script is entirely optional.
  17. * @author Chris Corbyn <chris@w3style.co.uk>
  18. * @package Yay
  19. */
  20. // Classes
  21. /**
  22. * Allow occurences of Yay_Expectations::create() to be replaced with Expectations::create().
  23. */
  24. class Expectations extends Yay_Expectations { }
  25. /**
  26. * Allows occurences of new Yay_Mockery() to be replaced with new Mockery().
  27. */
  28. class Mockery extends Yay_Mockery { }
  29. //Argument matchers
  30. /**
  31. * Allows Yay::optional() to be called as optional().
  32. */
  33. function optional($value = null)
  34. {
  35. return Yay::optional($value);
  36. }
  37. /**
  38. * Allows Yay::any() to be called as any().
  39. */
  40. function any($type = null)
  41. {
  42. return Yay::any($type);
  43. }
  44. /**
  45. * Allows Yay::none() to be called as none().
  46. */
  47. function none($type = null)
  48. {
  49. return Yay::none($type);
  50. }
  51. /**
  52. * Allows Yay::identical() to be called as identical().
  53. */
  54. function identical($value)
  55. {
  56. return Yay::identical($value);
  57. }
  58. /**
  59. * Allows Yay::notIdentical() to be called as notIdentical().
  60. */
  61. function notIdentical($value)
  62. {
  63. return Yay::notIdentical($value);
  64. }
  65. /**
  66. * Allows Yay::equal() to be called as equal().
  67. */
  68. function equal($value)
  69. {
  70. return Yay::equal($value);
  71. }
  72. /**
  73. * Allows Yay::notEqual() to be called as notEqual().
  74. */
  75. function notEqual($value)
  76. {
  77. return Yay::notEqual($value);
  78. }
  79. /**
  80. * Allows Yay::pattern() to be called as pattern().
  81. */
  82. function pattern($pattern)
  83. {
  84. return Yay::pattern($pattern);
  85. }
  86. /**
  87. * Allows Yay::noPattern() to be called as noPattern().
  88. */
  89. function noPattern($pattern)
  90. {
  91. return Yay::noPattern($pattern);
  92. }
  93. /**
  94. * Allows Yay::bounds() to be called as bounds().
  95. */
  96. function bounds($a, $b)
  97. {
  98. return Yay::bounds($a, $b);
  99. }
  100. /**
  101. * Allows Yay::outside() to be called as outside().
  102. */
  103. function outside($a, $b)
  104. {
  105. return Yay::outside($a, $b);
  106. }
  107. /**
  108. * Allows Yay::reference() to be called as reference().
  109. */
  110. function reference(&$ref)
  111. {
  112. return Yay::reference($ref);
  113. }
  114. /**
  115. * Allows Yay::noReference() to be called as noReference().
  116. */
  117. function noReference(&$ref)
  118. {
  119. return Yay::noReference($ref);
  120. }
  121. //Actions
  122. /**
  123. * Allows Yay::returnValue() to be called as returnValue().
  124. */
  125. function returnValue($value)
  126. {
  127. return Yay::returnValue($value);
  128. }
  129. /**
  130. * Allows Yay::returnReference() to be called as returnReference().
  131. */
  132. function returnReference(&$ref)
  133. {
  134. return Yay::returnReference($ref);
  135. }
  136. /**
  137. * Allows Yay::throwException() to be called as throwException().
  138. */
  139. function throwException(Exception $e)
  140. {
  141. return Yay::throwException($e);
  142. }
  143. /**
  144. * Allows Yay::call() to be called as call().
  145. */
  146. function call($callback)
  147. {
  148. return Yay::call($callback);
  149. }