mardi 15 décembre 2015

Laravel 5.1 : Testbench install in Own Package instead of Main Application

I'm creating my own package in Laravel 5.1. My package has an own composer.json, in which I added:

"require-dev": {
    "orchestra/testbench": "~3.1"
}

When I do a composer install, Testbench requires a lot of dependencies (including Laravel 5.2):

"require": {
    "php": ">=5.5.0",
    "laravel/framework": "~5.2.0",
    "orchestra/database": "~3.2.0",
    "symfony/css-selector": "2.8.*|3.0.*",
    "symfony/dom-crawler": "2.8.*|3.0.*"
},
"require-dev": {
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0|~5.0"
}

It seems that Testbench has to be installed in de main installation. But then, I cannot deal with tests after publishing my package to for example Github.

So my thoughts are these:

  • Install Testbench via global composer.json
  • Install Testbench via my package composer.json, and after that: I remove the requirements (e.g. Laravel 5.2 requirement) and do an update
  • I use the global phpunit instead of Testbench

I'm a little bit confused. How to use Testbench in my custom package without a sub installation of Laravel Framework and a lot of extra dependencies linked to Testbench?

Aucun commentaire:

Enregistrer un commentaire