blumilksoftware / blt

Behat+Laravel toolbox. Still in progress.
https://packagist.org/packages/blumilksoftware/blt
3 stars 0 forks source link

Remove app() helper #3

Closed krzysztofrewak closed 3 years ago

krzysztofrewak commented 3 years ago

As @Baakoma suggested, we should try to remove app() helper from the Features. Probably we could inject it with some constructors... but I don't know how to do that with traits. Additionally, I don't want to add entire Laravel as dependency too, so it can be hard.

It's used here:

krzysztofrewak commented 3 years ago

I'm afraid that we cannot inject anything into context's constructor as it's not built with service container.

In Validator.php line 61:

  Can not find a matching value for an argument `$app` of the method `App\Testing\Context\Eloquent\Users::__construct()`.  

behat [-s|--suite SUITE] [-f|--format FORMAT] [-o|--out OUT] [--format-settings FORMAT-SETTINGS] [--init] [--lang LANG] [--name NAME] [--tags TAGS] [--role ROLE] [--story-syntax] [-d|--definitions DEFINITIONS] [--snippets-for [SNIPPETS-FOR]] [--snippets-type SNIPPETS-TYPE] [--append-snippets] [--no-snippets] [--strict] [--order ORDER] [--rerun] [--stop-on-failure] [--dry-run] [--] [<paths>]

Behat docs provides a way to setting up constructor values, but it looks like it's working with primitive types only.