Skip to content

Added grabRepository function#27

Merged
DavertMik merged 1 commit into
Codeception:masterfrom
TavoNiievez:grabRepository
Nov 13, 2020
Merged

Added grabRepository function#27
DavertMik merged 1 commit into
Codeception:masterfrom
TavoNiievez:grabRepository

Conversation

@TavoNiievez

@TavoNiievez TavoNiievez commented Nov 7, 2020

Copy link
Copy Markdown
Member

$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
Copy Markdown
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