Last active
November 2, 2018 19:43
-
-
Save muglug/45c8f47ded9bbc2fd53a065079bd6f6d to your computer and use it in GitHub Desktop.
Stub class for common PHPUnit methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace PHPUnit\Framework; | |
use PHPUnit\Framework\MockObject\MockObject; | |
abstract class TestCase extends Assert implements Test, SelfDescribing | |
{ | |
/** | |
* @template T | |
* @template-typeof T $class | |
* @param class-string $class | |
* @return MockObject&T | |
*/ | |
public function createMock($class) {} | |
/** | |
* Asserts that a variable is of a given type. | |
* | |
* @param class-string $expected | |
* @param mixed $actual | |
* @param string $message | |
* | |
* @template T | |
* @template-typeof T $expected | |
* @psalm-assert T $actual | |
*/ | |
public static function assertInstanceOf($expected, $actual, $message = '') {} | |
/** | |
* Asserts that a variable is of a given type. | |
* | |
* @param class-string $expected | |
* @param mixed $actual | |
* @param string $message | |
* | |
* @template T | |
* @template-typeof T $expected | |
* @psalm-assert !T $actual | |
*/ | |
public static function assertNotInstanceOf($expected, $actual, $message = '') {} | |
/** | |
* Asserts that a condition is true. | |
* | |
* @param bool $condition | |
* @param string $message | |
* | |
* @throws AssertionFailedError | |
* @psalm-assert true $actual | |
*/ | |
public static function assertTrue($condition, $message = '') {} | |
/** | |
* Asserts that a condition is not true. | |
* | |
* @param bool $condition | |
* @param string $message | |
* | |
* @throws AssertionFailedError | |
* @psalm-assert !true $actual | |
*/ | |
public static function assertNotTrue($condition, $message = '') {} | |
/** | |
* Asserts that a condition is false. | |
* | |
* @param bool $condition | |
* @param string $message | |
* | |
* @throws AssertionFailedError | |
* @psalm-assert false $actual | |
*/ | |
public static function assertFalse($condition, $message = '') {} | |
/** | |
* Asserts that a condition is not false. | |
* | |
* @param bool $condition | |
* @param string $message | |
* | |
* @throws AssertionFailedError | |
* @psalm-assert !false $actual | |
*/ | |
public static function assertNotFalse($condition, $message = '') {} | |
/** | |
* Asserts that a variable is null. | |
* | |
* @param mixed $actual | |
* @param string $message | |
* @psalm-assert null $actual | |
*/ | |
public static function assertNull($actual, $message = '') {} | |
/** | |
* Asserts that a variable is not null. | |
* | |
* @param mixed $actual | |
* @param string $message | |
* @psalm-assert !null $actual | |
*/ | |
public static function assertNotNull($actual, $message = '') {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment