Hamcrest.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. <?php
  2. /*
  3. Copyright (c) 2009-2010 hamcrest.org
  4. */
  5. // This file is generated from the static method @factory doctags.
  6. if (!function_exists('assertThat')) {
  7. /**
  8. * Make an assertion and throw {@link Hamcrest_AssertionError} if it fails.
  9. *
  10. * Example:
  11. * <pre>
  12. * //With an identifier
  13. * assertThat("assertion identifier", $apple->flavour(), equalTo("tasty"));
  14. * //Without an identifier
  15. * assertThat($apple->flavour(), equalTo("tasty"));
  16. * //Evaluating a boolean expression
  17. * assertThat("some error", $a > $b);
  18. * </pre>
  19. */
  20. function assertThat()
  21. {
  22. $args = func_get_args();
  23. call_user_func_array(
  24. array('Hamcrest\MatcherAssert', 'assertThat'),
  25. $args
  26. );
  27. }
  28. }
  29. if (!function_exists('anArray')) {
  30. /**
  31. * Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
  32. */
  33. function anArray(/* args... */)
  34. {
  35. $args = func_get_args();
  36. return call_user_func_array(array('\Hamcrest\Arrays\IsArray', 'anArray'), $args);
  37. }
  38. }
  39. if (!function_exists('hasItemInArray')) {
  40. /**
  41. * Evaluates to true if any item in an array satisfies the given matcher.
  42. *
  43. * @param mixed $item as a {@link Hamcrest\Matcher} or a value.
  44. *
  45. * @return \Hamcrest\Arrays\IsArrayContaining
  46. */
  47. function hasItemInArray($item)
  48. {
  49. return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
  50. }
  51. }
  52. if (!function_exists('hasValue')) {
  53. /**
  54. * Evaluates to true if any item in an array satisfies the given matcher.
  55. *
  56. * @param mixed $item as a {@link Hamcrest\Matcher} or a value.
  57. *
  58. * @return \Hamcrest\Arrays\IsArrayContaining
  59. */
  60. function hasValue($item)
  61. {
  62. return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
  63. }
  64. }
  65. if (!function_exists('arrayContainingInAnyOrder')) {
  66. /**
  67. * An array with elements that match the given matchers.
  68. */
  69. function arrayContainingInAnyOrder(/* args... */)
  70. {
  71. $args = func_get_args();
  72. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
  73. }
  74. }
  75. if (!function_exists('containsInAnyOrder')) {
  76. /**
  77. * An array with elements that match the given matchers.
  78. */
  79. function containsInAnyOrder(/* args... */)
  80. {
  81. $args = func_get_args();
  82. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
  83. }
  84. }
  85. if (!function_exists('arrayContaining')) {
  86. /**
  87. * An array with elements that match the given matchers in the same order.
  88. */
  89. function arrayContaining(/* args... */)
  90. {
  91. $args = func_get_args();
  92. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
  93. }
  94. }
  95. if (!function_exists('contains')) {
  96. /**
  97. * An array with elements that match the given matchers in the same order.
  98. */
  99. function contains(/* args... */)
  100. {
  101. $args = func_get_args();
  102. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
  103. }
  104. }
  105. if (!function_exists('hasKeyInArray')) {
  106. /**
  107. * Evaluates to true if any key in an array matches the given matcher.
  108. *
  109. * @param mixed $key as a {@link Hamcrest\Matcher} or a value.
  110. *
  111. * @return \Hamcrest\Arrays\IsArrayContainingKey
  112. */
  113. function hasKeyInArray($key)
  114. {
  115. return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
  116. }
  117. }
  118. if (!function_exists('hasKey')) {
  119. /**
  120. * Evaluates to true if any key in an array matches the given matcher.
  121. *
  122. * @param mixed $key as a {@link Hamcrest\Matcher} or a value.
  123. *
  124. * @return \Hamcrest\Arrays\IsArrayContainingKey
  125. */
  126. function hasKey($key)
  127. {
  128. return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
  129. }
  130. }
  131. if (!function_exists('hasKeyValuePair')) {
  132. /**
  133. * Test if an array has both an key and value in parity with each other.
  134. */
  135. function hasKeyValuePair($key, $value)
  136. {
  137. return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
  138. }
  139. }
  140. if (!function_exists('hasEntry')) {
  141. /**
  142. * Test if an array has both an key and value in parity with each other.
  143. */
  144. function hasEntry($key, $value)
  145. {
  146. return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
  147. }
  148. }
  149. if (!function_exists('arrayWithSize')) {
  150. /**
  151. * Does array size satisfy a given matcher?
  152. *
  153. * @param \Hamcrest\Matcher|int $size as a {@link Hamcrest\Matcher} or a value.
  154. *
  155. * @return \Hamcrest\Arrays\IsArrayWithSize
  156. */
  157. function arrayWithSize($size)
  158. {
  159. return \Hamcrest\Arrays\IsArrayWithSize::arrayWithSize($size);
  160. }
  161. }
  162. if (!function_exists('emptyArray')) {
  163. /**
  164. * Matches an empty array.
  165. */
  166. function emptyArray()
  167. {
  168. return \Hamcrest\Arrays\IsArrayWithSize::emptyArray();
  169. }
  170. }
  171. if (!function_exists('nonEmptyArray')) {
  172. /**
  173. * Matches an empty array.
  174. */
  175. function nonEmptyArray()
  176. {
  177. return \Hamcrest\Arrays\IsArrayWithSize::nonEmptyArray();
  178. }
  179. }
  180. if (!function_exists('emptyTraversable')) {
  181. /**
  182. * Returns true if traversable is empty.
  183. */
  184. function emptyTraversable()
  185. {
  186. return \Hamcrest\Collection\IsEmptyTraversable::emptyTraversable();
  187. }
  188. }
  189. if (!function_exists('nonEmptyTraversable')) {
  190. /**
  191. * Returns true if traversable is not empty.
  192. */
  193. function nonEmptyTraversable()
  194. {
  195. return \Hamcrest\Collection\IsEmptyTraversable::nonEmptyTraversable();
  196. }
  197. }
  198. if (!function_exists('traversableWithSize')) {
  199. /**
  200. * Does traversable size satisfy a given matcher?
  201. */
  202. function traversableWithSize($size)
  203. {
  204. return \Hamcrest\Collection\IsTraversableWithSize::traversableWithSize($size);
  205. }
  206. }
  207. if (!function_exists('allOf')) {
  208. /**
  209. * Evaluates to true only if ALL of the passed in matchers evaluate to true.
  210. */
  211. function allOf(/* args... */)
  212. {
  213. $args = func_get_args();
  214. return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args);
  215. }
  216. }
  217. if (!function_exists('anyOf')) {
  218. /**
  219. * Evaluates to true if ANY of the passed in matchers evaluate to true.
  220. */
  221. function anyOf(/* args... */)
  222. {
  223. $args = func_get_args();
  224. return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args);
  225. }
  226. }
  227. if (!function_exists('noneOf')) {
  228. /**
  229. * Evaluates to false if ANY of the passed in matchers evaluate to true.
  230. */
  231. function noneOf(/* args... */)
  232. {
  233. $args = func_get_args();
  234. return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'noneOf'), $args);
  235. }
  236. }
  237. if (!function_exists('both')) {
  238. /**
  239. * This is useful for fluently combining matchers that must both pass.
  240. * For example:
  241. * <pre>
  242. * assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
  243. * </pre>
  244. */
  245. function both(\Hamcrest\Matcher $matcher)
  246. {
  247. return \Hamcrest\Core\CombinableMatcher::both($matcher);
  248. }
  249. }
  250. if (!function_exists('either')) {
  251. /**
  252. * This is useful for fluently combining matchers where either may pass,
  253. * for example:
  254. * <pre>
  255. * assertThat($string, either(containsString("a"))->orElse(containsString("b")));
  256. * </pre>
  257. */
  258. function either(\Hamcrest\Matcher $matcher)
  259. {
  260. return \Hamcrest\Core\CombinableMatcher::either($matcher);
  261. }
  262. }
  263. if (!function_exists('describedAs')) {
  264. /**
  265. * Wraps an existing matcher and overrides the description when it fails.
  266. */
  267. function describedAs(/* args... */)
  268. {
  269. $args = func_get_args();
  270. return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args);
  271. }
  272. }
  273. if (!function_exists('everyItem')) {
  274. /**
  275. * @param Matcher $itemMatcher
  276. * A matcher to apply to every element in an array.
  277. *
  278. * @return \Hamcrest\Core\Every
  279. * Evaluates to TRUE for a collection in which every item matches $itemMatcher
  280. */
  281. function everyItem(\Hamcrest\Matcher $itemMatcher)
  282. {
  283. return \Hamcrest\Core\Every::everyItem($itemMatcher);
  284. }
  285. }
  286. if (!function_exists('hasToString')) {
  287. /**
  288. * Does array size satisfy a given matcher?
  289. */
  290. function hasToString($matcher)
  291. {
  292. return \Hamcrest\Core\HasToString::hasToString($matcher);
  293. }
  294. }
  295. if (!function_exists('is')) {
  296. /**
  297. * Decorates another Matcher, retaining the behavior but allowing tests
  298. * to be slightly more expressive.
  299. *
  300. * For example: assertThat($cheese, equalTo($smelly))
  301. * vs. assertThat($cheese, is(equalTo($smelly)))
  302. */
  303. function is($value)
  304. {
  305. return \Hamcrest\Core\Is::is($value);
  306. }
  307. }
  308. if (!function_exists('anything')) {
  309. /**
  310. * This matcher always evaluates to true.
  311. *
  312. * @param string $description A meaningful string used when describing itself.
  313. *
  314. * @return \Hamcrest\Core\IsAnything
  315. */
  316. function anything($description = 'ANYTHING')
  317. {
  318. return \Hamcrest\Core\IsAnything::anything($description);
  319. }
  320. }
  321. if (!function_exists('hasItem')) {
  322. /**
  323. * Test if the value is an array containing this matcher.
  324. *
  325. * Example:
  326. * <pre>
  327. * assertThat(array('a', 'b'), hasItem(equalTo('b')));
  328. * //Convenience defaults to equalTo()
  329. * assertThat(array('a', 'b'), hasItem('b'));
  330. * </pre>
  331. */
  332. function hasItem(/* args... */)
  333. {
  334. $args = func_get_args();
  335. return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args);
  336. }
  337. }
  338. if (!function_exists('hasItems')) {
  339. /**
  340. * Test if the value is an array containing elements that match all of these
  341. * matchers.
  342. *
  343. * Example:
  344. * <pre>
  345. * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
  346. * </pre>
  347. */
  348. function hasItems(/* args... */)
  349. {
  350. $args = func_get_args();
  351. return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args);
  352. }
  353. }
  354. if (!function_exists('equalTo')) {
  355. /**
  356. * Is the value equal to another value, as tested by the use of the "=="
  357. * comparison operator?
  358. */
  359. function equalTo($item)
  360. {
  361. return \Hamcrest\Core\IsEqual::equalTo($item);
  362. }
  363. }
  364. if (!function_exists('identicalTo')) {
  365. /**
  366. * Tests of the value is identical to $value as tested by the "===" operator.
  367. */
  368. function identicalTo($value)
  369. {
  370. return \Hamcrest\Core\IsIdentical::identicalTo($value);
  371. }
  372. }
  373. if (!function_exists('anInstanceOf')) {
  374. /**
  375. * Is the value an instance of a particular type?
  376. * This version assumes no relationship between the required type and
  377. * the signature of the method that sets it up, for example in
  378. * <code>assertThat($anObject, anInstanceOf('Thing'));</code>
  379. */
  380. function anInstanceOf($theClass)
  381. {
  382. return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
  383. }
  384. }
  385. if (!function_exists('any')) {
  386. /**
  387. * Is the value an instance of a particular type?
  388. * This version assumes no relationship between the required type and
  389. * the signature of the method that sets it up, for example in
  390. * <code>assertThat($anObject, anInstanceOf('Thing'));</code>
  391. */
  392. function any($theClass)
  393. {
  394. return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
  395. }
  396. }
  397. if (!function_exists('not')) {
  398. /**
  399. * Matches if value does not match $value.
  400. */
  401. function not($value)
  402. {
  403. return \Hamcrest\Core\IsNot::not($value);
  404. }
  405. }
  406. if (!function_exists('nullValue')) {
  407. /**
  408. * Matches if value is null.
  409. */
  410. function nullValue()
  411. {
  412. return \Hamcrest\Core\IsNull::nullValue();
  413. }
  414. }
  415. if (!function_exists('notNullValue')) {
  416. /**
  417. * Matches if value is not null.
  418. */
  419. function notNullValue()
  420. {
  421. return \Hamcrest\Core\IsNull::notNullValue();
  422. }
  423. }
  424. if (!function_exists('sameInstance')) {
  425. /**
  426. * Creates a new instance of IsSame.
  427. *
  428. * @param mixed $object
  429. * The predicate evaluates to true only when the argument is
  430. * this object.
  431. *
  432. * @return \Hamcrest\Core\IsSame
  433. */
  434. function sameInstance($object)
  435. {
  436. return \Hamcrest\Core\IsSame::sameInstance($object);
  437. }
  438. }
  439. if (!function_exists('typeOf')) {
  440. /**
  441. * Is the value a particular built-in type?
  442. */
  443. function typeOf($theType)
  444. {
  445. return \Hamcrest\Core\IsTypeOf::typeOf($theType);
  446. }
  447. }
  448. if (!function_exists('set')) {
  449. /**
  450. * Matches if value (class, object, or array) has named $property.
  451. */
  452. function set($property)
  453. {
  454. return \Hamcrest\Core\Set::set($property);
  455. }
  456. }
  457. if (!function_exists('notSet')) {
  458. /**
  459. * Matches if value (class, object, or array) does not have named $property.
  460. */
  461. function notSet($property)
  462. {
  463. return \Hamcrest\Core\Set::notSet($property);
  464. }
  465. }
  466. if (!function_exists('closeTo')) {
  467. /**
  468. * Matches if value is a number equal to $value within some range of
  469. * acceptable error $delta.
  470. */
  471. function closeTo($value, $delta)
  472. {
  473. return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta);
  474. }
  475. }
  476. if (!function_exists('comparesEqualTo')) {
  477. /**
  478. * The value is not > $value, nor < $value.
  479. */
  480. function comparesEqualTo($value)
  481. {
  482. return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value);
  483. }
  484. }
  485. if (!function_exists('greaterThan')) {
  486. /**
  487. * The value is > $value.
  488. */
  489. function greaterThan($value)
  490. {
  491. return \Hamcrest\Number\OrderingComparison::greaterThan($value);
  492. }
  493. }
  494. if (!function_exists('greaterThanOrEqualTo')) {
  495. /**
  496. * The value is >= $value.
  497. */
  498. function greaterThanOrEqualTo($value)
  499. {
  500. return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
  501. }
  502. }
  503. if (!function_exists('atLeast')) {
  504. /**
  505. * The value is >= $value.
  506. */
  507. function atLeast($value)
  508. {
  509. return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
  510. }
  511. }
  512. if (!function_exists('lessThan')) {
  513. /**
  514. * The value is < $value.
  515. */
  516. function lessThan($value)
  517. {
  518. return \Hamcrest\Number\OrderingComparison::lessThan($value);
  519. }
  520. }
  521. if (!function_exists('lessThanOrEqualTo')) {
  522. /**
  523. * The value is <= $value.
  524. */
  525. function lessThanOrEqualTo($value)
  526. {
  527. return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
  528. }
  529. }
  530. if (!function_exists('atMost')) {
  531. /**
  532. * The value is <= $value.
  533. */
  534. function atMost($value)
  535. {
  536. return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
  537. }
  538. }
  539. if (!function_exists('isEmptyString')) {
  540. /**
  541. * Matches if value is a zero-length string.
  542. */
  543. function isEmptyString()
  544. {
  545. return \Hamcrest\Text\IsEmptyString::isEmptyString();
  546. }
  547. }
  548. if (!function_exists('emptyString')) {
  549. /**
  550. * Matches if value is a zero-length string.
  551. */
  552. function emptyString()
  553. {
  554. return \Hamcrest\Text\IsEmptyString::isEmptyString();
  555. }
  556. }
  557. if (!function_exists('isEmptyOrNullString')) {
  558. /**
  559. * Matches if value is null or a zero-length string.
  560. */
  561. function isEmptyOrNullString()
  562. {
  563. return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
  564. }
  565. }
  566. if (!function_exists('nullOrEmptyString')) {
  567. /**
  568. * Matches if value is null or a zero-length string.
  569. */
  570. function nullOrEmptyString()
  571. {
  572. return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
  573. }
  574. }
  575. if (!function_exists('isNonEmptyString')) {
  576. /**
  577. * Matches if value is a non-zero-length string.
  578. */
  579. function isNonEmptyString()
  580. {
  581. return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
  582. }
  583. }
  584. if (!function_exists('nonEmptyString')) {
  585. /**
  586. * Matches if value is a non-zero-length string.
  587. */
  588. function nonEmptyString()
  589. {
  590. return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
  591. }
  592. }
  593. if (!function_exists('equalToIgnoringCase')) {
  594. /**
  595. * Matches if value is a string equal to $string, regardless of the case.
  596. */
  597. function equalToIgnoringCase($string)
  598. {
  599. return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string);
  600. }
  601. }
  602. if (!function_exists('equalToIgnoringWhiteSpace')) {
  603. /**
  604. * Matches if value is a string equal to $string, regardless of whitespace.
  605. */
  606. function equalToIgnoringWhiteSpace($string)
  607. {
  608. return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
  609. }
  610. }
  611. if (!function_exists('matchesPattern')) {
  612. /**
  613. * Matches if value is a string that matches regular expression $pattern.
  614. */
  615. function matchesPattern($pattern)
  616. {
  617. return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern);
  618. }
  619. }
  620. if (!function_exists('containsString')) {
  621. /**
  622. * Matches if value is a string that contains $substring.
  623. */
  624. function containsString($substring)
  625. {
  626. return \Hamcrest\Text\StringContains::containsString($substring);
  627. }
  628. }
  629. if (!function_exists('containsStringIgnoringCase')) {
  630. /**
  631. * Matches if value is a string that contains $substring regardless of the case.
  632. */
  633. function containsStringIgnoringCase($substring)
  634. {
  635. return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring);
  636. }
  637. }
  638. if (!function_exists('stringContainsInOrder')) {
  639. /**
  640. * Matches if value contains $substrings in a constrained order.
  641. */
  642. function stringContainsInOrder(/* args... */)
  643. {
  644. $args = func_get_args();
  645. return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args);
  646. }
  647. }
  648. if (!function_exists('endsWith')) {
  649. /**
  650. * Matches if value is a string that ends with $substring.
  651. */
  652. function endsWith($substring)
  653. {
  654. return \Hamcrest\Text\StringEndsWith::endsWith($substring);
  655. }
  656. }
  657. if (!function_exists('startsWith')) {
  658. /**
  659. * Matches if value is a string that starts with $substring.
  660. */
  661. function startsWith($substring)
  662. {
  663. return \Hamcrest\Text\StringStartsWith::startsWith($substring);
  664. }
  665. }
  666. if (!function_exists('arrayValue')) {
  667. /**
  668. * Is the value an array?
  669. */
  670. function arrayValue()
  671. {
  672. return \Hamcrest\Type\IsArray::arrayValue();
  673. }
  674. }
  675. if (!function_exists('booleanValue')) {
  676. /**
  677. * Is the value a boolean?
  678. */
  679. function booleanValue()
  680. {
  681. return \Hamcrest\Type\IsBoolean::booleanValue();
  682. }
  683. }
  684. if (!function_exists('boolValue')) {
  685. /**
  686. * Is the value a boolean?
  687. */
  688. function boolValue()
  689. {
  690. return \Hamcrest\Type\IsBoolean::booleanValue();
  691. }
  692. }
  693. if (!function_exists('callableValue')) {
  694. /**
  695. * Is the value callable?
  696. */
  697. function callableValue()
  698. {
  699. return \Hamcrest\Type\IsCallable::callableValue();
  700. }
  701. }
  702. if (!function_exists('doubleValue')) {
  703. /**
  704. * Is the value a float/double?
  705. */
  706. function doubleValue()
  707. {
  708. return \Hamcrest\Type\IsDouble::doubleValue();
  709. }
  710. }
  711. if (!function_exists('floatValue')) {
  712. /**
  713. * Is the value a float/double?
  714. */
  715. function floatValue()
  716. {
  717. return \Hamcrest\Type\IsDouble::doubleValue();
  718. }
  719. }
  720. if (!function_exists('integerValue')) {
  721. /**
  722. * Is the value an integer?
  723. */
  724. function integerValue()
  725. {
  726. return \Hamcrest\Type\IsInteger::integerValue();
  727. }
  728. }
  729. if (!function_exists('intValue')) {
  730. /**
  731. * Is the value an integer?
  732. */
  733. function intValue()
  734. {
  735. return \Hamcrest\Type\IsInteger::integerValue();
  736. }
  737. }
  738. if (!function_exists('numericValue')) {
  739. /**
  740. * Is the value a numeric?
  741. */
  742. function numericValue()
  743. {
  744. return \Hamcrest\Type\IsNumeric::numericValue();
  745. }
  746. }
  747. if (!function_exists('objectValue')) {
  748. /**
  749. * Is the value an object?
  750. */
  751. function objectValue()
  752. {
  753. return \Hamcrest\Type\IsObject::objectValue();
  754. }
  755. }
  756. if (!function_exists('anObject')) {
  757. /**
  758. * Is the value an object?
  759. */
  760. function anObject()
  761. {
  762. return \Hamcrest\Type\IsObject::objectValue();
  763. }
  764. }
  765. if (!function_exists('resourceValue')) {
  766. /**
  767. * Is the value a resource?
  768. */
  769. function resourceValue()
  770. {
  771. return \Hamcrest\Type\IsResource::resourceValue();
  772. }
  773. }
  774. if (!function_exists('scalarValue')) {
  775. /**
  776. * Is the value a scalar (boolean, integer, double, or string)?
  777. */
  778. function scalarValue()
  779. {
  780. return \Hamcrest\Type\IsScalar::scalarValue();
  781. }
  782. }
  783. if (!function_exists('stringValue')) {
  784. /**
  785. * Is the value a string?
  786. */
  787. function stringValue()
  788. {
  789. return \Hamcrest\Type\IsString::stringValue();
  790. }
  791. }
  792. if (!function_exists('hasXPath')) {
  793. /**
  794. * Wraps <code>$matcher</code> with {@link Hamcrest\Core\IsEqual)
  795. * if it's not a matcher and the XPath in <code>count()</code>
  796. * if it's an integer.
  797. */
  798. function hasXPath($xpath, $matcher = null)
  799. {
  800. return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher);
  801. }
  802. }