codeception/module-asserts
Codeception Asserts module adds rich assertion helpers for your tests, letting you use a wide set of PHPUnit-style assertions directly in Codeception suites. Ideal for unit, functional, and acceptance tests to keep checks readable and failures clear.
Add codeception/module-asserts to your codeception.yaml module configuration (or _bootstrap.php if per-suite). No setup is required—just ensure it's listed in the modules section under enabled. First use case: replace raw PHPUnit\Framework\TestCase::assertEquals() calls in unit tests with Codeception-native syntax like $this->assertEquals() directly incest. Check tests/_support/AcceptanceTester.php (or similar) to see the module’s methods automatically injected into actor classes.
assertEquals(), assertTrue(), assertArraySubset(), assertJsonStringEqualsJsonString(), etc., identically across unit, functional, and acceptance tests.$I->assertEquals(42, $result, 'Expected result after calculation'); for better failure diagnostics._helpers/Helper/Functional.php (or Unit) using $this->assert*() methods, then reuse across multiple test files without duplicating logic.assertJson($json), assertArrayHasKey(), or assertObjectHasAttribute() to validate structured responses.assertNotContains() must be invoked via $I->assertNotContains(...)—ensure your AcceptanceTester class includes the module’s traits (Codeception does this automatically if declared in codeception.yaml).codeception.yml includes module: [asserts].$message parameter (e.g., assertEquals($expected, $actual, 'Price should match after discount')) to surface test intent in logs._support/Helper/Unit.php (e.g., to add internal metrics logging on assertion failure).How can I help you explore Laravel packages today?