PageRenderTime 56ms CodeModel.GetById 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

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