MediaWiki-CodeSniffer
MediaWiki CodeSniffer Standards
Loading...
Searching...
No Matches
MediaWiki\Sniffs\PHPUnit Namespace Reference

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. More...

Classes

class  AssertCountSniff
 Replace assertEquals and assertSame where the actual value is count( anything ) with the more specific assertCount. More...
 
class  AssertEmptySniff
 Warn when using PHPUnit's looser assertEmpty() More...
 
class  AssertEqualsSniff
 Discourages the use of PHPUnit's relaxed, not type-safe assertEquals() in favor of strict alternatives like assertSame(), assertNull(), and such. More...
 
class  AssertionOrderSniff
 Fix uses of assertEquals/assertNotEquals or assertSame/assertNotSame with the actual value before the expected Currently, only catches assertions where the actual value is a variable, or at least starts with a variable token, and the expected is a literal value or a variable in the form $expected*, or an array of such values (including nested arrays). More...
 
class  DeprecatedPHPUnitMethodsSniff
 Forbids usage of PHPUnit methods deprecated/removed in PHPUnit8 @fixme Avoid duplication with other PHPUnit-related sniffs. More...
 
class  MockBoilerplateSniff
 Simplify set up of mocks in PHPUnit test cases: ->will( $this->returnValue( ... ) ) becomes ->willReturn( ... ) as well as other ->will() shortcuts, see PHPUnit docs table 8.1 ->with( $this->equalTo( ... ) ) becomes ->with( ... ), for any number of parameters provided, since equalTo() is the default constraint checked if a value is provided (as long as the equalTo() call only had a single parameter) ->exactly( 1 ) becomes ->once() ->exactly( 0 ) becomes ->never() More...
 
class  PHPUnitClassUsageSniff
 Converts PHPUnit_Framework_TestCase to the new PHPUnit 6 namespaced PHPUnit\Framework\Testcase. More...
 
class  PHPUnitTypeHintsSniff
 Ensure that setUp() and tearDown() have a void return type hint, since they were added in PHPUnit 8. More...
 
class  SetMethodsSniff
 Replace calls to MockBuilder::setMethods (deprecated in PHPUnit 8) with MockBuilder::onlyMethods. More...
 
class  SpecificAssertionsSniff
 Replace generic assertions about specific conditions. More...
 

Variables

trait PHPUnitTestTrait
 Check if a class is a test class.
 

Detailed Description

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Copyright (C) 2018 Kunal Mehta legok.nosp@m.tm@m.nosp@m.ember.nosp@m..fsf.nosp@m..org

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Variable Documentation

◆ PHPUnitTestTrait

trait MediaWiki::Sniffs::PHPUnit\PHPUnitTestTrait
Initial value:
{
private static $PHPUNIT_CLASSES = [
'MediaWikiTestCase' => 'MediaWikiTestCase',
'MediaWikiUnitTestCase' => 'MediaWikiUnitTestCase',
'MediaWikiIntegrationTestCase' => 'MediaWikiIntegrationTestCase',
'PHPUnit_Framework_TestCase' => 'PHPUnit_Framework_TestCase',
TestCase::class => TestCase::class,
]

Check if a class is a test class.

@license GPL-2.0-or-later