phpunit

PHPUnit

Used in 348 php projects (avg ★112)

PHP
Testing
Default
Used by 348 projects

Details

Language / Topic
phpPHP
Category
Testing

Rules

balanced

PHPUnit

- Use `#[Test]` attribute or `test` prefix for test methods. Use `assertEquals`, `assertSame`, `assertTrue`, `assertCount` for assertions. Use `setUp()` for per-test initialization and `tearDown()` for cleanup.

PHPUnit

- Use `#[Test]` attribute or `test` prefix for test methods. Use `assertEquals`, `assertSame`, `assertTrue`, `assertCount` for assertions. Use `setUp()` for per-test initialization and `tearDown()` for cleanup.
- Use `#[DataProvider]` for parameterized tests with multiple input sets. Use `createMock()` and `expects($this->once())->method('name')->willReturn(value)` for mocking. Use `expectException(ExceptionClass::class)` before the code that throws. Group tests with `#[Group('integration')]` for selective execution. Use `assertJsonStringEqualsJsonString()` for JSON comparison.