Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This extension provides following features:

* `createMock()`, `getMockForAbstractClass()` and `getMockFromWsdl()` methods return an intersection type (see the [detailed explanation of intersection types](https://phpstan.org/blog/union-types-vs-intersection-types)) of the mock object and the mocked class so that both methods from the mock object (like `expects`) and from the mocked class are available on the object.
* `getMock()` called on `MockBuilder` is also supported.
* `createMockForIntersectionOfInterfaces()` and `createStubForIntersectionOfInterfaces()` return correct intersection types.
* Interprets `Foo|MockObject` in phpDoc so that it results in an intersection type instead of a union type.
* Defines early terminating method calls for the `PHPUnit\Framework\TestCase` class to prevent undefined variable errors.
* Specifies types of expressions passed to various `assert` methods like `assertInstanceOf`, `assertTrue`, `assertInternalType` etc.
Expand All @@ -24,6 +25,13 @@ It also contains this strict framework-specific rules (can be enabled separately
* Check that you are not using `assertSame()` with `count($variable)` as second parameter. `assertCount($variable)` should be used instead.
* Check that you are not using `assertEquals()` with same types (`assertSame()` should be used)
* Check that you are not using `assertNotEquals()` with same types (`assertNotSame()` should be used)
* Validate `@covers` and `@coversDefaultClass` annotations reference existing classes, methods, and functions.
* Check that methods called on mock objects via `->method('...')` exist on the mocked class.
* Check that `setUp()` and `tearDown()` call their parent methods.
* Validate data provider declarations (method existence, naming, static requirement in PHPUnit 10+).
* Validate data provider return data matches test method parameters (bleeding edge).
* Validate `#[RequiresPhp]` attribute format.
* Check for proper spacing in PHPUnit annotations.

## How to document mock objects in phpDocs?

Expand Down