/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php

https://gitlab.com/judielsm/Handora · PHP · 1854 lines · 720 code · 103 blank · 1031 comment · 0 complexity · 861ea5b36a7698df559fe8cc2b235c17 MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of PHPUnit.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Returns a matcher that matches when the method is executed
  12. * zero or more times.
  13. *
  14. * @return PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount
  15. * @since Method available since Release 3.0.0
  16. */
  17. function any()
  18. {
  19. return call_user_func_array(
  20. 'PHPUnit_Framework_TestCase::any',
  21. func_get_args()
  22. );
  23. }
  24. /**
  25. * Returns a PHPUnit_Framework_Constraint_IsAnything matcher object.
  26. *
  27. * @return PHPUnit_Framework_Constraint_IsAnything
  28. * @since Method available since Release 3.0.0
  29. */
  30. function anything()
  31. {
  32. return call_user_func_array(
  33. 'PHPUnit_Framework_Assert::anything',
  34. func_get_args()
  35. );
  36. }
  37. /**
  38. * Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object.
  39. *
  40. * @param mixed $key
  41. * @return PHPUnit_Framework_Constraint_ArrayHasKey
  42. * @since Method available since Release 3.0.0
  43. */
  44. function arrayHasKey($key)
  45. {
  46. return call_user_func_array(
  47. 'PHPUnit_Framework_Assert::arrayHasKey',
  48. func_get_args()
  49. );
  50. }
  51. /**
  52. * Asserts that an array has a specified key.
  53. *
  54. * @param mixed $key
  55. * @param array|ArrayAccess $array
  56. * @param string $message
  57. * @since Method available since Release 3.0.0
  58. */
  59. function assertArrayHasKey($key, $array, $message = '')
  60. {
  61. return call_user_func_array(
  62. 'PHPUnit_Framework_Assert::assertArrayHasKey',
  63. func_get_args()
  64. );
  65. }
  66. /**
  67. * Asserts that an array has a specified subset.
  68. *
  69. * @param array|ArrayAccess $subset
  70. * @param array|ArrayAccess $array
  71. * @param bool $strict Check for object identity
  72. * @param string $message
  73. * @since Method available since Release 4.4.0
  74. */
  75. function assertArraySubset($subset, $array, $strict = false, $message = '')
  76. {
  77. return call_user_func_array(
  78. 'PHPUnit_Framework_Assert::assertArraySubset',
  79. func_get_args()
  80. );
  81. }
  82. /**
  83. * Asserts that an array does not have a specified key.
  84. *
  85. * @param mixed $key
  86. * @param array|ArrayAccess $array
  87. * @param string $message
  88. * @since Method available since Release 3.0.0
  89. */
  90. function assertArrayNotHasKey($key, $array, $message = '')
  91. {
  92. return call_user_func_array(
  93. 'PHPUnit_Framework_Assert::assertArrayNotHasKey',
  94. func_get_args()
  95. );
  96. }
  97. /**
  98. * Asserts that a haystack that is stored in a static attribute of a class
  99. * or an attribute of an object contains a needle.
  100. *
  101. * @param mixed $needle
  102. * @param string $haystackAttributeName
  103. * @param mixed $haystackClassOrObject
  104. * @param string $message
  105. * @param bool $ignoreCase
  106. * @param bool $checkForObjectIdentity
  107. * @param bool $checkForNonObjectIdentity
  108. * @since Method available since Release 3.0.0
  109. */
  110. function assertAttributeContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
  111. {
  112. return call_user_func_array(
  113. 'PHPUnit_Framework_Assert::assertAttributeContains',
  114. func_get_args()
  115. );
  116. }
  117. /**
  118. * Asserts that a haystack that is stored in a static attribute of a class
  119. * or an attribute of an object contains only values of a given type.
  120. *
  121. * @param string $type
  122. * @param string $haystackAttributeName
  123. * @param mixed $haystackClassOrObject
  124. * @param bool $isNativeType
  125. * @param string $message
  126. * @since Method available since Release 3.1.4
  127. */
  128. function assertAttributeContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $message = '')
  129. {
  130. return call_user_func_array(
  131. 'PHPUnit_Framework_Assert::assertAttributeContainsOnly',
  132. func_get_args()
  133. );
  134. }
  135. /**
  136. * Asserts the number of elements of an array, Countable or Traversable
  137. * that is stored in an attribute.
  138. *
  139. * @param int $expectedCount
  140. * @param string $haystackAttributeName
  141. * @param mixed $haystackClassOrObject
  142. * @param string $message
  143. * @since Method available since Release 3.6.0
  144. */
  145. function assertAttributeCount($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = '')
  146. {
  147. return call_user_func_array(
  148. 'PHPUnit_Framework_Assert::assertAttributeCount',
  149. func_get_args()
  150. );
  151. }
  152. /**
  153. * Asserts that a static attribute of a class or an attribute of an object
  154. * is empty.
  155. *
  156. * @param string $haystackAttributeName
  157. * @param mixed $haystackClassOrObject
  158. * @param string $message
  159. * @since Method available since Release 3.5.0
  160. */
  161. function assertAttributeEmpty($haystackAttributeName, $haystackClassOrObject, $message = '')
  162. {
  163. return call_user_func_array(
  164. 'PHPUnit_Framework_Assert::assertAttributeEmpty',
  165. func_get_args()
  166. );
  167. }
  168. /**
  169. * Asserts that a variable is equal to an attribute of an object.
  170. *
  171. * @param mixed $expected
  172. * @param string $actualAttributeName
  173. * @param string $actualClassOrObject
  174. * @param string $message
  175. * @param float $delta
  176. * @param int $maxDepth
  177. * @param bool $canonicalize
  178. * @param bool $ignoreCase
  179. */
  180. function assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
  181. {
  182. return call_user_func_array(
  183. 'PHPUnit_Framework_Assert::assertAttributeEquals',
  184. func_get_args()
  185. );
  186. }
  187. /**
  188. * Asserts that an attribute is greater than another value.
  189. *
  190. * @param mixed $expected
  191. * @param string $actualAttributeName
  192. * @param string $actualClassOrObject
  193. * @param string $message
  194. * @since Method available since Release 3.1.0
  195. */
  196. function assertAttributeGreaterThan($expected, $actualAttributeName, $actualClassOrObject, $message = '')
  197. {
  198. return call_user_func_array(
  199. 'PHPUnit_Framework_Assert::assertAttributeGreaterThan',
  200. func_get_args()
  201. );
  202. }
  203. /**
  204. * Asserts that an attribute is greater than or equal to another value.
  205. *
  206. * @param mixed $expected
  207. * @param string $actualAttributeName
  208. * @param string $actualClassOrObject
  209. * @param string $message
  210. * @since Method available since Release 3.1.0
  211. */
  212. function assertAttributeGreaterThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = '')
  213. {
  214. return call_user_func_array(
  215. 'PHPUnit_Framework_Assert::assertAttributeGreaterThanOrEqual',
  216. func_get_args()
  217. );
  218. }
  219. /**
  220. * Asserts that an attribute is of a given type.
  221. *
  222. * @param string $expected
  223. * @param string $attributeName
  224. * @param mixed $classOrObject
  225. * @param string $message
  226. * @since Method available since Release 3.5.0
  227. */
  228. function assertAttributeInstanceOf($expected, $attributeName, $classOrObject, $message = '')
  229. {
  230. return call_user_func_array(
  231. 'PHPUnit_Framework_Assert::assertAttributeInstanceOf',
  232. func_get_args()
  233. );
  234. }
  235. /**
  236. * Asserts that an attribute is of a given type.
  237. *
  238. * @param string $expected
  239. * @param string $attributeName
  240. * @param mixed $classOrObject
  241. * @param string $message
  242. * @since Method available since Release 3.5.0
  243. */
  244. function assertAttributeInternalType($expected, $attributeName, $classOrObject, $message = '')
  245. {
  246. return call_user_func_array(
  247. 'PHPUnit_Framework_Assert::assertAttributeInternalType',
  248. func_get_args()
  249. );
  250. }
  251. /**
  252. * Asserts that an attribute is smaller than another value.
  253. *
  254. * @param mixed $expected
  255. * @param string $actualAttributeName
  256. * @param string $actualClassOrObject
  257. * @param string $message
  258. * @since Method available since Release 3.1.0
  259. */
  260. function assertAttributeLessThan($expected, $actualAttributeName, $actualClassOrObject, $message = '')
  261. {
  262. return call_user_func_array(
  263. 'PHPUnit_Framework_Assert::assertAttributeLessThan',
  264. func_get_args()
  265. );
  266. }
  267. /**
  268. * Asserts that an attribute is smaller than or equal to another value.
  269. *
  270. * @param mixed $expected
  271. * @param string $actualAttributeName
  272. * @param string $actualClassOrObject
  273. * @param string $message
  274. * @since Method available since Release 3.1.0
  275. */
  276. function assertAttributeLessThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = '')
  277. {
  278. return call_user_func_array(
  279. 'PHPUnit_Framework_Assert::assertAttributeLessThanOrEqual',
  280. func_get_args()
  281. );
  282. }
  283. /**
  284. * Asserts that a haystack that is stored in a static attribute of a class
  285. * or an attribute of an object does not contain a needle.
  286. *
  287. * @param mixed $needle
  288. * @param string $haystackAttributeName
  289. * @param mixed $haystackClassOrObject
  290. * @param string $message
  291. * @param bool $ignoreCase
  292. * @param bool $checkForObjectIdentity
  293. * @param bool $checkForNonObjectIdentity
  294. * @since Method available since Release 3.0.0
  295. */
  296. function assertAttributeNotContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
  297. {
  298. return call_user_func_array(
  299. 'PHPUnit_Framework_Assert::assertAttributeNotContains',
  300. func_get_args()
  301. );
  302. }
  303. /**
  304. * Asserts that a haystack that is stored in a static attribute of a class
  305. * or an attribute of an object does not contain only values of a given
  306. * type.
  307. *
  308. * @param string $type
  309. * @param string $haystackAttributeName
  310. * @param mixed $haystackClassOrObject
  311. * @param bool $isNativeType
  312. * @param string $message
  313. * @since Method available since Release 3.1.4
  314. */
  315. function assertAttributeNotContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $message = '')
  316. {
  317. return call_user_func_array(
  318. 'PHPUnit_Framework_Assert::assertAttributeNotContainsOnly',
  319. func_get_args()
  320. );
  321. }
  322. /**
  323. * Asserts the number of elements of an array, Countable or Traversable
  324. * that is stored in an attribute.
  325. *
  326. * @param int $expectedCount
  327. * @param string $haystackAttributeName
  328. * @param mixed $haystackClassOrObject
  329. * @param string $message
  330. * @since Method available since Release 3.6.0
  331. */
  332. function assertAttributeNotCount($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = '')
  333. {
  334. return call_user_func_array(
  335. 'PHPUnit_Framework_Assert::assertAttributeNotCount',
  336. func_get_args()
  337. );
  338. }
  339. /**
  340. * Asserts that a static attribute of a class or an attribute of an object
  341. * is not empty.
  342. *
  343. * @param string $haystackAttributeName
  344. * @param mixed $haystackClassOrObject
  345. * @param string $message
  346. * @since Method available since Release 3.5.0
  347. */
  348. function assertAttributeNotEmpty($haystackAttributeName, $haystackClassOrObject, $message = '')
  349. {
  350. return call_user_func_array(
  351. 'PHPUnit_Framework_Assert::assertAttributeNotEmpty',
  352. func_get_args()
  353. );
  354. }
  355. /**
  356. * Asserts that a variable is not equal to an attribute of an object.
  357. *
  358. * @param mixed $expected
  359. * @param string $actualAttributeName
  360. * @param string $actualClassOrObject
  361. * @param string $message
  362. * @param float $delta
  363. * @param int $maxDepth
  364. * @param bool $canonicalize
  365. * @param bool $ignoreCase
  366. */
  367. function assertAttributeNotEquals($expected, $actualAttributeName, $actualClassOrObject, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
  368. {
  369. return call_user_func_array(
  370. 'PHPUnit_Framework_Assert::assertAttributeNotEquals',
  371. func_get_args()
  372. );
  373. }
  374. /**
  375. * Asserts that an attribute is of a given type.
  376. *
  377. * @param string $expected
  378. * @param string $attributeName
  379. * @param mixed $classOrObject
  380. * @param string $message
  381. * @since Method available since Release 3.5.0
  382. */
  383. function assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message = '')
  384. {
  385. return call_user_func_array(
  386. 'PHPUnit_Framework_Assert::assertAttributeNotInstanceOf',
  387. func_get_args()
  388. );
  389. }
  390. /**
  391. * Asserts that an attribute is of a given type.
  392. *
  393. * @param string $expected
  394. * @param string $attributeName
  395. * @param mixed $classOrObject
  396. * @param string $message
  397. * @since Method available since Release 3.5.0
  398. */
  399. function assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message = '')
  400. {
  401. return call_user_func_array(
  402. 'PHPUnit_Framework_Assert::assertAttributeNotInternalType',
  403. func_get_args()
  404. );
  405. }
  406. /**
  407. * Asserts that a variable and an attribute of an object do not have the
  408. * same type and value.
  409. *
  410. * @param mixed $expected
  411. * @param string $actualAttributeName
  412. * @param object $actualClassOrObject
  413. * @param string $message
  414. */
  415. function assertAttributeNotSame($expected, $actualAttributeName, $actualClassOrObject, $message = '')
  416. {
  417. return call_user_func_array(
  418. 'PHPUnit_Framework_Assert::assertAttributeNotSame',
  419. func_get_args()
  420. );
  421. }
  422. /**
  423. * Asserts that a variable and an attribute of an object have the same type
  424. * and value.
  425. *
  426. * @param mixed $expected
  427. * @param string $actualAttributeName
  428. * @param object $actualClassOrObject
  429. * @param string $message
  430. */
  431. function assertAttributeSame($expected, $actualAttributeName, $actualClassOrObject, $message = '')
  432. {
  433. return call_user_func_array(
  434. 'PHPUnit_Framework_Assert::assertAttributeSame',
  435. func_get_args()
  436. );
  437. }
  438. /**
  439. * Asserts that a class has a specified attribute.
  440. *
  441. * @param string $attributeName
  442. * @param string $className
  443. * @param string $message
  444. * @since Method available since Release 3.1.0
  445. */
  446. function assertClassHasAttribute($attributeName, $className, $message = '')
  447. {
  448. return call_user_func_array(
  449. 'PHPUnit_Framework_Assert::assertClassHasAttribute',
  450. func_get_args()
  451. );
  452. }
  453. /**
  454. * Asserts that a class has a specified static attribute.
  455. *
  456. * @param string $attributeName
  457. * @param string $className
  458. * @param string $message
  459. * @since Method available since Release 3.1.0
  460. */
  461. function assertClassHasStaticAttribute($attributeName, $className, $message = '')
  462. {
  463. return call_user_func_array(
  464. 'PHPUnit_Framework_Assert::assertClassHasStaticAttribute',
  465. func_get_args()
  466. );
  467. }
  468. /**
  469. * Asserts that a class does not have a specified attribute.
  470. *
  471. * @param string $attributeName
  472. * @param string $className
  473. * @param string $message
  474. * @since Method available since Release 3.1.0
  475. */
  476. function assertClassNotHasAttribute($attributeName, $className, $message = '')
  477. {
  478. return call_user_func_array(
  479. 'PHPUnit_Framework_Assert::assertClassNotHasAttribute',
  480. func_get_args()
  481. );
  482. }
  483. /**
  484. * Asserts that a class does not have a specified static attribute.
  485. *
  486. * @param string $attributeName
  487. * @param string $className
  488. * @param string $message
  489. * @since Method available since Release 3.1.0
  490. */
  491. function assertClassNotHasStaticAttribute($attributeName, $className, $message = '')
  492. {
  493. return call_user_func_array(
  494. 'PHPUnit_Framework_Assert::assertClassNotHasStaticAttribute',
  495. func_get_args()
  496. );
  497. }
  498. /**
  499. * Asserts that a haystack contains a needle.
  500. *
  501. * @param mixed $needle
  502. * @param mixed $haystack
  503. * @param string $message
  504. * @param bool $ignoreCase
  505. * @param bool $checkForObjectIdentity
  506. * @param bool $checkForNonObjectIdentity
  507. * @since Method available since Release 2.1.0
  508. */
  509. function assertContains($needle, $haystack, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
  510. {
  511. return call_user_func_array(
  512. 'PHPUnit_Framework_Assert::assertContains',
  513. func_get_args()
  514. );
  515. }
  516. /**
  517. * Asserts that a haystack contains only values of a given type.
  518. *
  519. * @param string $type
  520. * @param mixed $haystack
  521. * @param bool $isNativeType
  522. * @param string $message
  523. * @since Method available since Release 3.1.4
  524. */
  525. function assertContainsOnly($type, $haystack, $isNativeType = null, $message = '')
  526. {
  527. return call_user_func_array(
  528. 'PHPUnit_Framework_Assert::assertContainsOnly',
  529. func_get_args()
  530. );
  531. }
  532. /**
  533. * Asserts that a haystack contains only instances of a given classname
  534. *
  535. * @param string $classname
  536. * @param array|Traversable $haystack
  537. * @param string $message
  538. */
  539. function assertContainsOnlyInstancesOf($classname, $haystack, $message = '')
  540. {
  541. return call_user_func_array(
  542. 'PHPUnit_Framework_Assert::assertContainsOnlyInstancesOf',
  543. func_get_args()
  544. );
  545. }
  546. /**
  547. * Asserts the number of elements of an array, Countable or Traversable.
  548. *
  549. * @param int $expectedCount
  550. * @param mixed $haystack
  551. * @param string $message
  552. */
  553. function assertCount($expectedCount, $haystack, $message = '')
  554. {
  555. return call_user_func_array(
  556. 'PHPUnit_Framework_Assert::assertCount',
  557. func_get_args()
  558. );
  559. }
  560. /**
  561. * Asserts that a variable is empty.
  562. *
  563. * @param mixed $actual
  564. * @param string $message
  565. * @throws PHPUnit_Framework_AssertionFailedError
  566. */
  567. function assertEmpty($actual, $message = '')
  568. {
  569. return call_user_func_array(
  570. 'PHPUnit_Framework_Assert::assertEmpty',
  571. func_get_args()
  572. );
  573. }
  574. /**
  575. * Asserts that a hierarchy of DOMElements matches.
  576. *
  577. * @param DOMElement $expectedElement
  578. * @param DOMElement $actualElement
  579. * @param bool $checkAttributes
  580. * @param string $message
  581. * @since Method available since Release 3.3.0
  582. */
  583. function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, $checkAttributes = false, $message = '')
  584. {
  585. return call_user_func_array(
  586. 'PHPUnit_Framework_Assert::assertEqualXMLStructure',
  587. func_get_args()
  588. );
  589. }
  590. /**
  591. * Asserts that two variables are equal.
  592. *
  593. * @param mixed $expected
  594. * @param mixed $actual
  595. * @param string $message
  596. * @param float $delta
  597. * @param int $maxDepth
  598. * @param bool $canonicalize
  599. * @param bool $ignoreCase
  600. */
  601. function assertEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
  602. {
  603. return call_user_func_array(
  604. 'PHPUnit_Framework_Assert::assertEquals',
  605. func_get_args()
  606. );
  607. }
  608. /**
  609. * Asserts that a condition is not true.
  610. *
  611. * @param bool $condition
  612. * @param string $message
  613. * @throws PHPUnit_Framework_AssertionFailedError
  614. */
  615. function assertNotTrue($condition, $message = '')
  616. {
  617. return call_user_func_array(
  618. 'PHPUnit_Framework_Assert::assertNotTrue',
  619. func_get_args()
  620. );
  621. }
  622. /**
  623. * Asserts that a condition is false.
  624. *
  625. * @param bool $condition
  626. * @param string $message
  627. * @throws PHPUnit_Framework_AssertionFailedError
  628. */
  629. function assertFalse($condition, $message = '')
  630. {
  631. return call_user_func_array(
  632. 'PHPUnit_Framework_Assert::assertFalse',
  633. func_get_args()
  634. );
  635. }
  636. /**
  637. * Asserts that the contents of one file is equal to the contents of another
  638. * file.
  639. *
  640. * @param string $expected
  641. * @param string $actual
  642. * @param string $message
  643. * @param bool $canonicalize
  644. * @param bool $ignoreCase
  645. * @since Method available since Release 3.2.14
  646. */
  647. function assertFileEquals($expected, $actual, $message = '', $canonicalize = false, $ignoreCase = false)
  648. {
  649. return call_user_func_array(
  650. 'PHPUnit_Framework_Assert::assertFileEquals',
  651. func_get_args()
  652. );
  653. }
  654. /**
  655. * Asserts that a file exists.
  656. *
  657. * @param string $filename
  658. * @param string $message
  659. * @since Method available since Release 3.0.0
  660. */
  661. function assertFileExists($filename, $message = '')
  662. {
  663. return call_user_func_array(
  664. 'PHPUnit_Framework_Assert::assertFileExists',
  665. func_get_args()
  666. );
  667. }
  668. /**
  669. * Asserts that the contents of one file is not equal to the contents of
  670. * another file.
  671. *
  672. * @param string $expected
  673. * @param string $actual
  674. * @param string $message
  675. * @param bool $canonicalize
  676. * @param bool $ignoreCase
  677. * @since Method available since Release 3.2.14
  678. */
  679. function assertFileNotEquals($expected, $actual, $message = '', $canonicalize = false, $ignoreCase = false)
  680. {
  681. return call_user_func_array(
  682. 'PHPUnit_Framework_Assert::assertFileNotEquals',
  683. func_get_args()
  684. );
  685. }
  686. /**
  687. * Asserts that a file does not exist.
  688. *
  689. * @param string $filename
  690. * @param string $message
  691. * @since Method available since Release 3.0.0
  692. */
  693. function assertFileNotExists($filename, $message = '')
  694. {
  695. return call_user_func_array(
  696. 'PHPUnit_Framework_Assert::assertFileNotExists',
  697. func_get_args()
  698. );
  699. }
  700. /**
  701. * Asserts that a value is greater than another value.
  702. *
  703. * @param mixed $expected
  704. * @param mixed $actual
  705. * @param string $message
  706. * @since Method available since Release 3.1.0
  707. */
  708. function assertGreaterThan($expected, $actual, $message = '')
  709. {
  710. return call_user_func_array(
  711. 'PHPUnit_Framework_Assert::assertGreaterThan',
  712. func_get_args()
  713. );
  714. }
  715. /**
  716. * Asserts that a value is greater than or equal to another value.
  717. *
  718. * @param mixed $expected
  719. * @param mixed $actual
  720. * @param string $message
  721. * @since Method available since Release 3.1.0
  722. */
  723. function assertGreaterThanOrEqual($expected, $actual, $message = '')
  724. {
  725. return call_user_func_array(
  726. 'PHPUnit_Framework_Assert::assertGreaterThanOrEqual',
  727. func_get_args()
  728. );
  729. }
  730. /**
  731. * Asserts that a variable is of a given type.
  732. *
  733. * @param string $expected
  734. * @param mixed $actual
  735. * @param string $message
  736. * @since Method available since Release 3.5.0
  737. */
  738. function assertInstanceOf($expected, $actual, $message = '')
  739. {
  740. return call_user_func_array(
  741. 'PHPUnit_Framework_Assert::assertInstanceOf',
  742. func_get_args()
  743. );
  744. }
  745. /**
  746. * Asserts that a variable is of a given type.
  747. *
  748. * @param string $expected
  749. * @param mixed $actual
  750. * @param string $message
  751. * @since Method available since Release 3.5.0
  752. */
  753. function assertInternalType($expected, $actual, $message = '')
  754. {
  755. return call_user_func_array(
  756. 'PHPUnit_Framework_Assert::assertInternalType',
  757. func_get_args()
  758. );
  759. }
  760. /**
  761. * Asserts that a string is a valid JSON string.
  762. *
  763. * @param string $actualJson
  764. * @param string $message
  765. * @since Method available since Release 3.7.20
  766. */
  767. function assertJson($actualJson, $message = '')
  768. {
  769. return call_user_func_array(
  770. 'PHPUnit_Framework_Assert::assertJson',
  771. func_get_args()
  772. );
  773. }
  774. /**
  775. * Asserts that two JSON files are equal.
  776. *
  777. * @param string $expectedFile
  778. * @param string $actualFile
  779. * @param string $message
  780. */
  781. function assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = '')
  782. {
  783. return call_user_func_array(
  784. 'PHPUnit_Framework_Assert::assertJsonFileEqualsJsonFile',
  785. func_get_args()
  786. );
  787. }
  788. /**
  789. * Asserts that two JSON files are not equal.
  790. *
  791. * @param string $expectedFile
  792. * @param string $actualFile
  793. * @param string $message
  794. */
  795. function assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = '')
  796. {
  797. return call_user_func_array(
  798. 'PHPUnit_Framework_Assert::assertJsonFileNotEqualsJsonFile',
  799. func_get_args()
  800. );
  801. }
  802. /**
  803. * Asserts that the generated JSON encoded object and the content of the given file are equal.
  804. *
  805. * @param string $expectedFile
  806. * @param string $actualJson
  807. * @param string $message
  808. */
  809. function assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = '')
  810. {
  811. return call_user_func_array(
  812. 'PHPUnit_Framework_Assert::assertJsonStringEqualsJsonFile',
  813. func_get_args()
  814. );
  815. }
  816. /**
  817. * Asserts that two given JSON encoded objects or arrays are equal.
  818. *
  819. * @param string $expectedJson
  820. * @param string $actualJson
  821. * @param string $message
  822. */
  823. function assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = '')
  824. {
  825. return call_user_func_array(
  826. 'PHPUnit_Framework_Assert::assertJsonStringEqualsJsonString',
  827. func_get_args()
  828. );
  829. }
  830. /**
  831. * Asserts that the generated JSON encoded object and the content of the given file are not equal.
  832. *
  833. * @param string $expectedFile
  834. * @param string $actualJson
  835. * @param string $message
  836. */
  837. function assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = '')
  838. {
  839. return call_user_func_array(
  840. 'PHPUnit_Framework_Assert::assertJsonStringNotEqualsJsonFile',
  841. func_get_args()
  842. );
  843. }
  844. /**
  845. * Asserts that two given JSON encoded objects or arrays are not equal.
  846. *
  847. * @param string $expectedJson
  848. * @param string $actualJson
  849. * @param string $message
  850. */
  851. function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = '')
  852. {
  853. return call_user_func_array(
  854. 'PHPUnit_Framework_Assert::assertJsonStringNotEqualsJsonString',
  855. func_get_args()
  856. );
  857. }
  858. /**
  859. * Asserts that a value is smaller than another value.
  860. *
  861. * @param mixed $expected
  862. * @param mixed $actual
  863. * @param string $message
  864. * @since Method available since Release 3.1.0
  865. */
  866. function assertLessThan($expected, $actual, $message = '')
  867. {
  868. return call_user_func_array(
  869. 'PHPUnit_Framework_Assert::assertLessThan',
  870. func_get_args()
  871. );
  872. }
  873. /**
  874. * Asserts that a value is smaller than or equal to another value.
  875. *
  876. * @param mixed $expected
  877. * @param mixed $actual
  878. * @param string $message
  879. * @since Method available since Release 3.1.0
  880. */
  881. function assertLessThanOrEqual($expected, $actual, $message = '')
  882. {
  883. return call_user_func_array(
  884. 'PHPUnit_Framework_Assert::assertLessThanOrEqual',
  885. func_get_args()
  886. );
  887. }
  888. /**
  889. * Asserts that a haystack does not contain a needle.
  890. *
  891. * @param mixed $needle
  892. * @param mixed $haystack
  893. * @param string $message
  894. * @param bool $ignoreCase
  895. * @param bool $checkForObjectIdentity
  896. * @param bool $checkForNonObjectIdentity
  897. * @since Method available since Release 2.1.0
  898. */
  899. function assertNotContains($needle, $haystack, $message = '', $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)
  900. {
  901. return call_user_func_array(
  902. 'PHPUnit_Framework_Assert::assertNotContains',
  903. func_get_args()
  904. );
  905. }
  906. /**
  907. * Asserts that a haystack does not contain only values of a given type.
  908. *
  909. * @param string $type
  910. * @param mixed $haystack
  911. * @param bool $isNativeType
  912. * @param string $message
  913. * @since Method available since Release 3.1.4
  914. */
  915. function assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = '')
  916. {
  917. return call_user_func_array(
  918. 'PHPUnit_Framework_Assert::assertNotContainsOnly',
  919. func_get_args()
  920. );
  921. }
  922. /**
  923. * Asserts the number of elements of an array, Countable or Traversable.
  924. *
  925. * @param int $expectedCount
  926. * @param mixed $haystack
  927. * @param string $message
  928. */
  929. function assertNotCount($expectedCount, $haystack, $message = '')
  930. {
  931. return call_user_func_array(
  932. 'PHPUnit_Framework_Assert::assertNotCount',
  933. func_get_args()
  934. );
  935. }
  936. /**
  937. * Asserts that a variable is not empty.
  938. *
  939. * @param mixed $actual
  940. * @param string $message
  941. * @throws PHPUnit_Framework_AssertionFailedError
  942. */
  943. function assertNotEmpty($actual, $message = '')
  944. {
  945. return call_user_func_array(
  946. 'PHPUnit_Framework_Assert::assertNotEmpty',
  947. func_get_args()
  948. );
  949. }
  950. /**
  951. * Asserts that two variables are not equal.
  952. *
  953. * @param mixed $expected
  954. * @param mixed $actual
  955. * @param string $message
  956. * @param float $delta
  957. * @param int $maxDepth
  958. * @param bool $canonicalize
  959. * @param bool $ignoreCase
  960. * @since Method available since Release 2.3.0
  961. */
  962. function assertNotEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
  963. {
  964. return call_user_func_array(
  965. 'PHPUnit_Framework_Assert::assertNotEquals',
  966. func_get_args()
  967. );
  968. }
  969. /**
  970. * Asserts that a variable is not of a given type.
  971. *
  972. * @param string $expected
  973. * @param mixed $actual
  974. * @param string $message
  975. * @since Method available since Release 3.5.0
  976. */
  977. function assertNotInstanceOf($expected, $actual, $message = '')
  978. {
  979. return call_user_func_array(
  980. 'PHPUnit_Framework_Assert::assertNotInstanceOf',
  981. func_get_args()
  982. );
  983. }
  984. /**
  985. * Asserts that a variable is not of a given type.
  986. *
  987. * @param string $expected
  988. * @param mixed $actual
  989. * @param string $message
  990. * @since Method available since Release 3.5.0
  991. */
  992. function assertNotInternalType($expected, $actual, $message = '')
  993. {
  994. return call_user_func_array(
  995. 'PHPUnit_Framework_Assert::assertNotInternalType',
  996. func_get_args()
  997. );
  998. }
  999. /**
  1000. * Asserts that a condition is not false.
  1001. *
  1002. * @param bool $condition
  1003. * @param string $message
  1004. * @throws PHPUnit_Framework_AssertionFailedError
  1005. */
  1006. function assertNotFalse($condition, $message = '')
  1007. {
  1008. return call_user_func_array(
  1009. 'PHPUnit_Framework_Assert::assertNotFalse',
  1010. func_get_args()
  1011. );
  1012. }
  1013. /**
  1014. * Asserts that a variable is not null.
  1015. *
  1016. * @param mixed $actual
  1017. * @param string $message
  1018. */
  1019. function assertNotNull($actual, $message = '')
  1020. {
  1021. return call_user_func_array(
  1022. 'PHPUnit_Framework_Assert::assertNotNull',
  1023. func_get_args()
  1024. );
  1025. }
  1026. /**
  1027. * Asserts that a string does not match a given regular expression.
  1028. *
  1029. * @param string $pattern
  1030. * @param string $string
  1031. * @param string $message
  1032. * @since Method available since Release 2.1.0
  1033. */
  1034. function assertNotRegExp($pattern, $string, $message = '')
  1035. {
  1036. return call_user_func_array(
  1037. 'PHPUnit_Framework_Assert::assertNotRegExp',
  1038. func_get_args()
  1039. );
  1040. }
  1041. /**
  1042. * Asserts that two variables do not have the same type and value.
  1043. * Used on objects, it asserts that two variables do not reference
  1044. * the same object.
  1045. *
  1046. * @param mixed $expected
  1047. * @param mixed $actual
  1048. * @param string $message
  1049. */
  1050. function assertNotSame($expected, $actual, $message = '')
  1051. {
  1052. return call_user_func_array(
  1053. 'PHPUnit_Framework_Assert::assertNotSame',
  1054. func_get_args()
  1055. );
  1056. }
  1057. /**
  1058. * Assert that the size of two arrays (or `Countable` or `Traversable` objects)
  1059. * is not the same.
  1060. *
  1061. * @param array|Countable|Traversable $expected
  1062. * @param array|Countable|Traversable $actual
  1063. * @param string $message
  1064. */
  1065. function assertNotSameSize($expected, $actual, $message = '')
  1066. {
  1067. return call_user_func_array(
  1068. 'PHPUnit_Framework_Assert::assertNotSameSize',
  1069. func_get_args()
  1070. );
  1071. }
  1072. /**
  1073. * This assertion is the exact opposite of assertTag().
  1074. *
  1075. * Rather than asserting that $matcher results in a match, it asserts that
  1076. * $matcher does not match.
  1077. *
  1078. * @param array $matcher
  1079. * @param string $actual
  1080. * @param string $message
  1081. * @param bool $isHtml
  1082. * @since Method available since Release 3.3.0
  1083. */
  1084. function assertNotTag($matcher, $actual, $message = '', $isHtml = true)
  1085. {
  1086. return call_user_func_array(
  1087. 'PHPUnit_Framework_Assert::assertNotTag',
  1088. func_get_args()
  1089. );
  1090. }
  1091. /**
  1092. * Asserts that a variable is null.
  1093. *
  1094. * @param mixed $actual
  1095. * @param string $message
  1096. */
  1097. function assertNull($actual, $message = '')
  1098. {
  1099. return call_user_func_array(
  1100. 'PHPUnit_Framework_Assert::assertNull',
  1101. func_get_args()
  1102. );
  1103. }
  1104. /**
  1105. * Asserts that an object has a specified attribute.
  1106. *
  1107. * @param string $attributeName
  1108. * @param object $object
  1109. * @param string $message
  1110. * @since Method available since Release 3.0.0
  1111. */
  1112. function assertObjectHasAttribute($attributeName, $object, $message = '')
  1113. {
  1114. return call_user_func_array(
  1115. 'PHPUnit_Framework_Assert::assertObjectHasAttribute',
  1116. func_get_args()
  1117. );
  1118. }
  1119. /**
  1120. * Asserts that an object does not have a specified attribute.
  1121. *
  1122. * @param string $attributeName
  1123. * @param object $object
  1124. * @param string $message
  1125. * @since Method available since Release 3.0.0
  1126. */
  1127. function assertObjectNotHasAttribute($attributeName, $object, $message = '')
  1128. {
  1129. return call_user_func_array(
  1130. 'PHPUnit_Framework_Assert::assertObjectNotHasAttribute',
  1131. func_get_args()
  1132. );
  1133. }
  1134. /**
  1135. * Asserts that a string matches a given regular expression.
  1136. *
  1137. * @param string $pattern
  1138. * @param string $string
  1139. * @param string $message
  1140. */
  1141. function assertRegExp($pattern, $string, $message = '')
  1142. {
  1143. return call_user_func_array(
  1144. 'PHPUnit_Framework_Assert::assertRegExp',
  1145. func_get_args()
  1146. );
  1147. }
  1148. /**
  1149. * Asserts that two variables have the same type and value.
  1150. * Used on objects, it asserts that two variables reference
  1151. * the same object.
  1152. *
  1153. * @param mixed $expected
  1154. * @param mixed $actual
  1155. * @param string $message
  1156. */
  1157. function assertSame($expected, $actual, $message = '')
  1158. {
  1159. return call_user_func_array(
  1160. 'PHPUnit_Framework_Assert::assertSame',
  1161. func_get_args()
  1162. );
  1163. }
  1164. /**
  1165. * Assert that the size of two arrays (or `Countable` or `Traversable` objects)
  1166. * is the same.
  1167. *
  1168. * @param array|Countable|Traversable $expected
  1169. * @param array|Countable|Traversable $actual
  1170. * @param string $message
  1171. */
  1172. function assertSameSize($expected, $actual, $message = '')
  1173. {
  1174. return call_user_func_array(
  1175. 'PHPUnit_Framework_Assert::assertSameSize',
  1176. func_get_args()
  1177. );
  1178. }
  1179. /**
  1180. * Assert the presence, absence, or count of elements in a document matching
  1181. * the CSS $selector, regardless of the contents of those elements.
  1182. *
  1183. * The first argument, $selector, is the CSS selector used to match
  1184. * the elements in the $actual document.
  1185. *
  1186. * The second argument, $count, can be either boolean or numeric.
  1187. * When boolean, it asserts for presence of elements matching the selector
  1188. * (true) or absence of elements (false).
  1189. * When numeric, it asserts the count of elements.
  1190. *
  1191. * assertSelectCount("#binder", true, $xml); // any?
  1192. * assertSelectCount(".binder", 3, $xml); // exactly 3?
  1193. *
  1194. * @param array $selector
  1195. * @param int $count
  1196. * @param mixed $actual
  1197. * @param string $message
  1198. * @param bool $isHtml
  1199. * @since Method available since Release 3.3.0
  1200. */
  1201. function assertSelectCount($selector, $count, $actual, $message = '', $isHtml = true)
  1202. {
  1203. return call_user_func_array(
  1204. 'PHPUnit_Framework_Assert::assertSelectCount',
  1205. func_get_args()
  1206. );
  1207. }
  1208. /**
  1209. * assertSelectEquals("#binder .name", "Chuck", true, $xml); // any?
  1210. * assertSelectEquals("#binder .name", "Chuck", false, $xml); // none?
  1211. *
  1212. * @param array $selector
  1213. * @param string $content
  1214. * @param int $count
  1215. * @param mixed $actual
  1216. * @param string $message
  1217. * @param bool $isHtml
  1218. * @since Method available since Release 3.3.0
  1219. */
  1220. function assertSelectEquals($selector, $content, $count, $actual, $message = '', $isHtml = true)
  1221. {
  1222. return call_user_func_array(
  1223. 'PHPUnit_Framework_Assert::assertSelectEquals',
  1224. func_get_args()
  1225. );
  1226. }
  1227. /**
  1228. * assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any?
  1229. * assertSelectRegExp("#binder .name", "/Mike|Derek/", 3, $xml);// 3?
  1230. *
  1231. * @param array $selector
  1232. * @param string $pattern
  1233. * @param int $count
  1234. * @param mixed $actual
  1235. * @param string $message
  1236. * @param bool $isHtml
  1237. * @since Method available since Release 3.3.0
  1238. */
  1239. function assertSelectRegExp($selector, $pattern, $count, $actual, $message = '', $isHtml = true)
  1240. {
  1241. return call_user_func_array(
  1242. 'PHPUnit_Framework_Assert::assertSelectRegExp',
  1243. func_get_args()
  1244. );
  1245. }
  1246. /**
  1247. * Asserts that a string ends not with a given prefix.
  1248. *
  1249. * @param string $suffix
  1250. * @param string $string
  1251. * @param string $message
  1252. * @since Method available since Release 3.4.0
  1253. */
  1254. function assertStringEndsNotWith($suffix, $string, $message = '')
  1255. {
  1256. return call_user_func_array(
  1257. 'PHPUnit_Framework_Assert::assertStringEndsNotWith',
  1258. func_get_args()
  1259. );
  1260. }
  1261. /**
  1262. * Asserts that a string ends with a given prefix.
  1263. *
  1264. * @param string $suffix
  1265. * @param string $string
  1266. * @param string $message
  1267. * @since Method available since Release 3.4.0
  1268. */
  1269. function assertStringEndsWith($suffix, $string, $message = '')
  1270. {
  1271. return call_user_func_array(
  1272. 'PHPUnit_Framework_Assert::assertStringEndsWith',
  1273. func_get_args()
  1274. );
  1275. }
  1276. /**
  1277. * Asserts that the contents of a string is equal
  1278. * to the contents of a file.
  1279. *
  1280. * @param string $expectedFile
  1281. * @param string $actualString
  1282. * @param string $message
  1283. * @param bool $canonicalize
  1284. * @param bool $ignoreCase
  1285. * @since Method available since Release 3.3.0
  1286. */
  1287. function assertStringEqualsFile($expectedFile, $actualString, $message = '', $canonicalize = false, $ignoreCase = false)
  1288. {
  1289. return call_user_func_array(
  1290. 'PHPUnit_Framework_Assert::assertStringEqualsFile',
  1291. func_get_args()
  1292. );
  1293. }
  1294. /**
  1295. * Asserts that a string matches a given format string.
  1296. *
  1297. * @param string $format
  1298. * @param string $string
  1299. * @param string $message
  1300. * @since Method available since Release 3.5.0
  1301. */
  1302. function assertStringMatchesFormat($format, $string, $message = '')
  1303. {
  1304. return call_user_func_array(
  1305. 'PHPUnit_Framework_Assert::assertStringMatchesFormat',
  1306. func_get_args()
  1307. );
  1308. }
  1309. /**
  1310. * Asserts that a string matches a given format file.
  1311. *
  1312. * @param string $formatFile
  1313. * @param string $string
  1314. * @param string $message
  1315. * @since Method available since Release 3.5.0
  1316. */
  1317. function assertStringMatchesFormatFile($formatFile, $string, $message = '')
  1318. {
  1319. return call_user_func_array(
  1320. 'PHPUnit_Framework_Assert::assertStringMatchesFormatFile',
  1321. func_get_args()
  1322. );
  1323. }
  1324. /**
  1325. * Asserts that the contents of a string is not equal
  1326. * to the contents of a file.
  1327. *
  1328. * @param string $expectedFile
  1329. * @param string $actualString
  1330. * @param string $message
  1331. * @param bool $canonicalize
  1332. * @param bool $ignoreCase
  1333. * @since Method available since Release 3.3.0
  1334. */
  1335. function assertStringNotEqualsFile($expectedFile, $actualString, $message = '', $canonicalize = false, $ignoreCase = false)
  1336. {
  1337. return call_user_func_array(
  1338. 'PHPUnit_Framework_Assert::assertStringNotEqualsFile',
  1339. func_get_args()
  1340. );
  1341. }
  1342. /**
  1343. * Asserts that a string does not match a given format string.
  1344. *
  1345. * @param string $format
  1346. * @param string $string
  1347. * @param string $message
  1348. * @since Method available since Release 3.5.0
  1349. */
  1350. function assertStringNotMatchesFormat($format, $string, $message = '')
  1351. {
  1352. return call_user_func_array(
  1353. 'PHPUnit_Framework_Assert::assertStringNotMatchesFormat',
  1354. func_get_args()
  1355. );
  1356. }
  1357. /**
  1358. * Asserts that a string does not match a given format string.
  1359. *
  1360. * @param string $formatFile
  1361. * @param string $string
  1362. * @param string $message
  1363. * @since Method available since Release 3.5.0
  1364. */
  1365. function assertStringNotMatchesFormatFile($formatFile, $string, $message = '')
  1366. {
  1367. return call_user_func_array(
  1368. 'PHPUnit_Framework_Assert::assertStringNotMatchesFormatFile',
  1369. func_get_args()
  1370. );
  1371. }
  1372. /**
  1373. * Asserts that a string starts not with a given prefix.
  1374. *
  1375. * @param string $prefix
  1376. * @param string $string
  1377. * @param string $message
  1378. * @since Method available since Release 3.4.0
  1379. */
  1380. function assertStringStartsNotWith($prefix, $string, $message = '')
  1381. {
  1382. return call_user_func_array(
  1383. 'PHPUnit_Framework_Assert::assertStringStartsNotWith',
  1384. func_get_args()
  1385. );
  1386. }
  1387. /**
  1388. * Asserts that a string starts with a given prefix.
  1389. *
  1390. * @param string $prefix
  1391. * @param string $string
  1392. * @param string $message
  1393. * @since Method available since Release 3.4.0
  1394. */
  1395. function assertStringStartsWith($prefix, $string, $message = '')
  1396. {
  1397. return call_user_func_array(
  1398. 'PHPUnit_Framework_Assert::assertStringStartsWith',
  1399. func_get_args()
  1400. );
  1401. }
  1402. /**
  1403. * Evaluate an HTML or XML string and assert its structure and/or contents.
  1404. *
  1405. * The first argument ($matcher) is an associative array that specifies the
  1406. * match criteria for the assertion:
  1407. *
  1408. * - `id` : the node with the given id attribute must match the
  1409. * corresponding value.
  1410. * - `tag` : the node type must match the corresponding value.
  1411. * - `attributes` : a hash. The node's attributes must match the
  1412. * corresponding values in the hash.
  1413. * - `content` : The text content must match the given value.
  1414. * - `parent` : a hash. The node's parent must match the
  1415. * corresponding hash.
  1416. * - `child`: a hash. At least one of the node's immediate children
  1417. * must meet the criteria described by the hash.
  1418. * - `ancestor` : a hash. At least one of the node's ancestors must
  1419. * meet the criteria described by the hash.
  1420. * - `descendant` : a hash. At least one of the node's descendants must
  1421. * meet the criteria described by the hash.
  1422. * - `children` : a hash, for counting children of a node.
  1423. * Accepts the keys:
  1424. *- `count`: a number which must equal the number of children
  1425. * that match
  1426. *- `less_than`: the number of matching children must be greater
  1427. * than this number
  1428. *- `greater_than` : the number of matching children must be less than
  1429. * this number
  1430. *- `only` : another hash consisting of the keys to use to match
  1431. * on the children, and only matching children will be
  1432. * counted
  1433. *
  1434. * <code>
  1435. * // Matcher that asserts that there is an element with an id="my_id".
  1436. * $matcher = array('id' => 'my_id');
  1437. *
  1438. * // Matcher that asserts that there is a "span" tag.
  1439. * $matcher = array('tag' => 'span');
  1440. *
  1441. * // Matcher that asserts that there is a "span" tag with the content
  1442. * // "Hello World".
  1443. * $matcher = array('tag' => 'span', 'content' => 'Hello World');
  1444. *
  1445. * // Matcher that asserts that there is a "span" tag with content matching
  1446. * // the regular expression pattern.
  1447. * $matcher = array('tag' => 'span', 'content' => 'regexp:/Try P(HP|ython)/');
  1448. *
  1449. * // Matcher that asserts that there is a "span" with an "list" class
  1450. * // attribute.
  1451. * $matcher = array(
  1452. * 'tag'=> 'span',
  1453. * 'attributes' => array('class' => 'list')
  1454. * );
  1455. *
  1456. * // Matcher that asserts that there is a "span" inside of a "div".
  1457. * $matcher = array(
  1458. * 'tag'=> 'span',
  1459. * 'parent' => array('tag' => 'div')
  1460. * );
  1461. *
  1462. * // Matcher that asserts that there is a "span" somewhere inside a
  1463. * // "table".
  1464. * $matcher = array(
  1465. * 'tag' => 'span',
  1466. * 'ancestor' => array('tag' => 'table')
  1467. * );
  1468. *
  1469. * // Matcher that asserts that there is a "span" with at least one "em"
  1470. * // child.
  1471. * $matcher = array(
  1472. * 'tag' => 'span',
  1473. * 'child' => array('tag' => 'em')
  1474. * );
  1475. *
  1476. * // Matcher that asserts that there is a "span" containing a (possibly
  1477. * // nested) "strong" tag.
  1478. * $matcher = array(
  1479. * 'tag'=> 'span',
  1480. * 'descendant' => array('tag' => 'strong')
  1481. * );
  1482. *
  1483. * // Matcher that asserts that there is a "span" containing 5-10 "em" tags
  1484. * // as immediate children.
  1485. * $matcher = array(
  1486. * 'tag' => 'span',
  1487. * 'children' => array(
  1488. * 'less_than'=> 11,
  1489. * 'greater_than' => 4,
  1490. * 'only' => array('tag' => 'em')
  1491. * )
  1492. * );
  1493. *
  1494. * // Matcher that asserts that there is a "div", with an "ul" ancestor and
  1495. * // a "li" parent (with class="enum"), and containing a "span" descendant
  1496. * // that contains an element with id="my_test" and the text "Hello World".
  1497. * $matcher = array(
  1498. * 'tag'=> 'div',
  1499. * 'ancestor' => array('tag' => 'ul'),
  1500. * 'parent' => array(
  1501. * 'tag'=> 'li',
  1502. * 'attributes' => array('class' => 'enum')
  1503. * ),
  1504. * 'descendant' => array(
  1505. * 'tag' => 'span',
  1506. * 'child' => array(
  1507. * 'id' => 'my_test',
  1508. * 'content' => 'Hello World'
  1509. * )
  1510. * )
  1511. * );
  1512. *
  1513. * // Use assertTag() to apply a $matcher to a piece of $html.
  1514. * $this->assertTag($matcher, $html);
  1515. *
  1516. * // Use assertTag() to apply a $matcher to a piece of $xml.
  1517. * $this->assertTag($matcher, $xml, '', false);
  1518. * </code>
  1519. *
  1520. * The second argument ($actual) is a string containing either HTML or
  1521. * XML text to be tested.
  1522. *
  1523. * The third argument ($message) is an optional message that will be
  1524. * used if the assertion fails.
  1525. *
  1526. * The fourth argument ($html) is an optional flag specifying whether
  1527. * to load the $actual string into a DOMDocument using the HTML or
  1528. * XML load strategy. It is true by default, which assumes the HTML
  1529. * load strategy. In many cases, this will be acceptable for XML as well.
  1530. *
  1531. * @param array $matcher
  1532. * @param string $actual
  1533. * @param string $message
  1534. * @param bool $isHtml
  1535. * @since Method available since Release 3.3.0
  1536. */
  1537. function assertTag($matcher, $actual, $message = '', $isHtml = true)
  1538. {
  1539. return call_user_func_array(
  1540. 'PHPUnit_Framework_Assert::assertTag',
  1541. func_get_args()
  1542. );
  1543. }
  1544. /**
  1545. * Evaluates a PHPUnit_Framework_Constraint matcher object.
  1546. *
  1547. * @param mixed$value
  1548. * @param PHPUnit_Framework_Constraint $constraint
  1549. * @param string $message
  1550. * @since Method available since Release 3.0.0
  1551. */
  1552. function assertThat($value, PHPUnit_Framework_Constraint $constraint, $message = '')
  1553. {
  1554. return call_user_func_array(
  1555. 'PHPUnit_Framework_Assert::assertThat',
  1556. func_get_args()
  1557. );
  1558. }
  1559. /**
  1560. * Asserts that a condition is true.
  1561. *
  1562. * @param bool $condition
  1563. * @param string $message
  1564. * @throws PHPUnit_Framework_AssertionFailedError
  1565. */
  1566. function assertTrue($condition, $message = '')
  1567. {
  1568. return call_user_func_array(
  1569. 'PHPUnit_Framework_Assert::assertTrue',
  1570. func_get_args()
  1571. );
  1572. }
  1573. /**
  1574. * Asserts that two XML files are equal.
  1575. *
  1576. * @param string $expectedFile
  1577. * @param string $actualFile
  1578. * @param string $message
  1579. * @since Method available since Release 3.1.0
  1580. */
  1581. function assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = '')
  1582. {
  1583. return call_user_func_array(
  1584. 'PHPUnit_Framework_Assert::assertXmlFileEqualsXmlFile',
  1585. func_get_args()
  1586. );
  1587. }
  1588. /**
  1589. * Asserts that two XML files are not equal.
  1590. *
  1591. * @param string $expectedFile
  1592. * @param string $actualFile
  1593. * @param string $message
  1594. * @since Method available since Release 3.1.0
  1595. */
  1596. function assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = '')
  1597. {
  1598. return call_user_func_array(
  1599. 'PHPUnit_Framework_Assert::assertXmlFileNotEqualsXmlFile',
  1600. func_get_args()
  1601. );
  1602. }
  1603. /**
  1604. * Asserts that two XML documents are equal.
  1605. *
  1606. * @param string $expectedFile
  1607. * @param string $actualXml
  1608. * @param string $message
  1609. * @since Method available since Release 3.3.0
  1610. */
  1611. function assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = '')
  1612. {
  1613. return call_user_func_array(
  1614. 'PHPUnit_Framework_Assert::assertXmlStringEqualsXmlFile',
  1615. func_get_args()
  1616. );
  1617. }
  1618. /**
  1619. * Asserts that two XML documents are equal.
  1620. *
  1621. * @param string $expectedXml
  1622. * @param string $actualXml
  1623. * @param string $message
  1624. * @since Method available since Release 3.1.0
  1625. */
  1626. function assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = '')
  1627. {
  1628. return call_user_func_array(
  1629. 'PHPUnit_Framework_Assert::assertXmlStringEqualsXmlString',
  1630. func_get_args()
  1631. );
  1632. }
  1633. /**
  1634. * Asserts that two XML documents are not equal.
  1635. *
  1636. * @param string $expectedFile
  1637. * @param string $actualXml
  1638. * @param string $message
  1639. * @since Method available since Release 3.3.0
  1640. */
  1641. function assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = '')
  1642. {
  1643. return call_user_func_array(
  1644. 'PHPUnit_Framework_Assert::assertXmlStringNotEqualsXmlFile',
  1645. func_get_args()
  1646. );
  1647. }
  1648. /**
  1649. * Asserts that two XML documents are not equal.
  1650. *
  1651. * @param string $expectedXml
  1652. * @param string $actualXml
  1653. * @param string $message
  1654. * @since Method available since Release 3.1.0
  1655. */
  1656. function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = '')
  1657. {
  1658. return call_user_func_array(
  1659. 'PHPUnit_Framework_Assert::assertXmlStringNotEqualsXmlString',
  1660. func_get_args()
  1661. );
  1662. }
  1663. /**
  1664. * Returns a matcher that matches when the method is executed
  1665. * at the given $index.
  1666. *
  1667. * @param int $index
  1668. * @return PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex
  1669. * @since Method available since Release 3.0.0
  1670. */
  1671. function at($index)
  1672. {
  1673. return call_user_func_array(
  1674. 'PHPUnit_Framework_TestCase::at',
  1675. func_get_args()
  1676. );
  1677. }
  1678. /**
  1679. * Returns a matcher that matches when the method is executed at least once.
  1680. *
  1681. * @return PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce
  1682. * @since Method available since Release 3.0.0
  1683. */
  1684. function atLeastOnce()
  1685. {
  1686. return call_user_func_array(
  1687. 'PHPUnit_Framework_TestCase::atLeastOnce',
  1688. func_get_args()
  1689. );
  1690. }
  1691. /**
  1692. * Returns a PHPUnit_Framework_Constraint_Attribute matcher object.
  1693. *
  1694. * @param PHPUnit_Framework_Constraint $constraint
  1695. * @param string $attributeName
  1696. * @return PHPUnit_Framework_Constraint_Attribute
  1697. * @since Method available since Release 3.1.0
  1698. */
  1699. function attribute(PHPUnit_Framework_Constraint $constraint, $attributeName)
  1700. {
  1701. return call_user_func_array(
  1702. 'PHPUnit_Framework_Assert::attribute',
  1703. func_get_args()
  1704. );
  1705. }
  1706. /**
  1707. * Returns a PHPUnit_Framework_Constraint_IsEqual matcher object
  1708. * that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher
  1709. * object.
  1710. *
  1711. * @param string $attributeName
  1712. * @param mixed $value
  1713. * @param float $delta
  1714. * @param int $maxDepth
  1715. * @param bool $canonicalize
  1716. * @param bool $ignoreCase
  1717. * @return PHPUnit_Framework_Constraint_Attribute
  1718. * @since Method available since Release 3.1.0
  1719. */
  1720. function attributeEqualTo($attributeName, $value, $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
  1721. {
  1722. return call_user_func_array(
  1723. 'PHPUnit_Framework_Assert::attributeEqualTo',
  1724. func_get_args()
  1725. );
  1726. }
  1727. /**
  1728. * Returns a PHPUnit_Framework_Constraint_Callback matcher object.
  1729. *
  1730. * @param callable $callback
  1731. * @return PHPUnit_Framework_Constraint_Callback
  1732. */
  1733. function callback($callback)
  1734. {
  1735. return call_user_func_array(
  1736. 'PHPUnit_Framework_Assert::callback',
  1737. func_get_args()
  1738. );
  1739. }
  1740. /**
  1741. * Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object.
  1742. *
  1743. * @param string $attributeName
  1744. * @return PHPUnit_Framework_Constraint_ClassHasAttribute
  1745. * @since Method available since Release 3.1.0
  1746. */
  1747. function classHasAttribute($attributeName)
  1748. {
  1749. return call_user_func_array(
  1750. 'PHPUnit_Framework_Assert::classHasAttribute',
  1751. func_get