Skip to content

Conversation

@Naktibalda
Copy link
Member

@Naktibalda Naktibalda commented Jul 2, 2022

Implements support for #[\Codeception\Attribute\DataProvider], #[\Codeception\Attribute\Examples] and @example annotation in unit tests.
Drops support for #[\PHPUnit\Attribute\DataProvider], @backupGlobals, @backupStaticAttributes, @preserveGlobalState and @testwith annotations.

I reused new DataProvider class is Cest Loader.

New possibilities:

  • Unit format can use private method as data providers
  • Cest format can use data provider methods from other classes.

@Naktibalda Naktibalda force-pushed the dataprovider branch 4 times, most recently from 2813c81 to d7a2c86 Compare July 2, 2022 19:24
@Naktibalda Naktibalda changed the title WIP: Support DataProvider attribute in unit tests Support DataProvider attribute in unit tests Jul 2, 2022
Drops support for @backupGlobals, @backupStaticAttributes, @preserveGlobalState and @testwith annotations
use function array_merge;
use function sprintf;

class DataProvider
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating this class is a brilliant idea! 👏

@eerison
Copy link

eerison commented Nov 16, 2023

Hey @Naktibalda could you give a bit more context why did you replaced @testWith to @example?

and do you have any recommendation which one use?

@example or data provider?

@Naktibalda
Copy link
Member Author

@eerison @Example is an old Codeception feature, it existed since Codeception 2.2.7
I wasn't even aware of @testwith until this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants