Remove Revision::getRevisionText from migrateArchiveText
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiTestCaseTrait.php
1 <?php
2
3 /**
4 * For code common to both MediaWikiUnitTestCase and MediaWikiIntegrationTestCase.
5 */
6 trait MediaWikiTestCaseTrait {
7 /**
8 * Returns a PHPUnit constraint that matches anything other than a fixed set of values. This can
9 * be used to whitelist values, e.g.
10 * $mock->expects( $this->never() )->method( $this->anythingBut( 'foo', 'bar' ) );
11 * which will throw if any unexpected method is called.
12 *
13 * @param mixed ...$values Values that are not matched
14 */
15 protected function anythingBut( ...$values ) {
16 return $this->logicalNot( $this->logicalOr(
17 ...array_map( [ $this, 'matches' ], $values )
18 ) );
19 }
20
21 /**
22 * Return a PHPUnit mock that is expected to never have any methods called on it.
23 *
24 * @param string $type
25 * @return object
26 */
27 protected function createNoOpMock( $type ) {
28 $mock = $this->createMock( $type );
29 $mock->expects( $this->never() )->method( $this->anythingBut( '__destruct' ) );
30 return $mock;
31 }
32 }