diff --git a/docs/AdvancedUsage.md b/docs/AdvancedUsage.md index 8b5442d5d..4312780d8 100644 --- a/docs/AdvancedUsage.md +++ b/docs/AdvancedUsage.md @@ -265,6 +265,32 @@ class EndpointCest ``` +## Example Annotation + +As well as the ``\Codeception\Example` attribute, available for Cest tests, the `@example` attribute allows you to +inject test parameters in place of an actual [DataProvider](#dataprovider-attribute) for Unit tests. + +```php +assertNotEmpty($value, "Expected a value"); + } +} +``` +> `@testWith`: as of [Codeception 5.0](https://github.com/Codeception/Codeception/pull/6491), PHPUnit's `@testWith` is no longer supported. `@example` is a good, almost drop-in, replacement. + ## DataProvider Attribute You can also use the `@dataProvider` annotation for creating dynamic examples for [Cest classes](#Cest-Classes), using a **protected method** for providing example data: diff --git a/guides/07-AdvancedUsage.md b/guides/07-AdvancedUsage.md index 473eef8cc..0e0978c61 100644 --- a/guides/07-AdvancedUsage.md +++ b/guides/07-AdvancedUsage.md @@ -258,6 +258,32 @@ class EndpointCest ``` +## Example Annotation + +As well as the ``\Codeception\Example` attribute, available for Cest tests, the `@example` attribute allows you to +inject test parameters in place of an actual [DataProvider](#dataprovider-attribute) for Unit tests. + +```php +assertNotEmpty($value, "Expected a value"); + } +} +``` +> `@testWith`: as of [Codeception 5.0](https://github.com/Codeception/Codeception/pull/6491), PHPUnit's `@testWith` is no longer supported. `@example` is a good, almost drop-in, replacement. + ## DataProvider Attribute You can also use the `@dataProvider` annotation for creating dynamic examples for [Cest classes](#Cest-Classes), using a **protected method** for providing example data: