samedi 1 juillet 2017

It's 2017 and I'm using Laravel 5.4. How do I run unit tests from within my Laravel package?

I am trying to develop a Laravel composer package and run unit tests from within it. After spending the last couple of days reading various outdated and contradictory guides and blogposts, I am completely confused as to how to go about this.

Here's what I know so far:

  • I shouldn't run tests from the main Laravel installation. Tests should all be contained within the package. I'll admit this has a certain logic to it.
  • There's something called Orchestra Testbench. If you're developing a Laravel package then apparently you should use this.
  • There's also something called Laravel Dusk, which is included in Laravel 5.4.

I can get Orchestra Test Bench working with some basic tests from the examples given, but I don't really understand what's going on and the documentation explains almost nothing. When it comes to testing my application's routes, I can't get anything to work.

I don't understand if Orchestra and Dusk can play together, or if I have to choose between them. If so, which one should I use? And if it's Laravel Dusk I should be using, then how do I run it from within my package directory?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire