Skip to content

Added grabRepository function #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2020
Merged

Added grabRepository function #27

merged 1 commit into from
Nov 13, 2020

Conversation

TavoNiievez
Copy link
Member

@TavoNiievez TavoNiievez commented Nov 7, 2020

$I->grabRepository significantly improves the readability of the tests that communicate with the database :)

as mentioned in the docblock, it works with:

  • Entity objects,
$userRepository = $I->grabRepository($user);
  • Entity classes,
$userRepository = $I->grabRepository(User::class);
  • Repository classes,
$userRepository = $I->grabRepository(UserRepository::class);
  • or even Custom Interfaces that have been implemented in a repository.
$userRepository = $I->grabRepository(UserRepositoryInterface::class);

It also includes validations in case of incorrect data and fails the test showing a corresponding error message.

@Naktibalda

@DavertMik
Copy link
Member

Awesome!

@DavertMik DavertMik merged commit a921d1f into Codeception:master Nov 13, 2020
@TavoNiievez TavoNiievez added this to the 1.3.0 milestone Nov 21, 2020
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.

2 participants