4 * For code common to both MediaWikiUnitTestCase and MediaWikiIntegrationTestCase.
6 trait MediaWikiTestCaseTrait
{
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.
13 * @param mixed ...$values Values that are not matched
15 protected function anythingBut( ...$values ) {
16 return $this->logicalNot( $this->logicalOr(
17 ...array_map( [ $this, 'matches' ], $values )
22 * Return a PHPUnit mock that is expected to never have any methods called on it.
27 protected function createNoOpMock( $type ) {
28 $mock = $this->createMock( $type );
29 $mock->expects( $this->never() )->method( $this->anythingBut( '__destruct' ) );