jarektkaczyk / laravel-kahlan

Laravel context for kahlan specs/tests - allows nice BDD way of developing Laravel app. https://softonsofa.com
16 stars 10 forks source link

Lumen compatibility #1

Closed rndmerle closed 6 years ago

rndmerle commented 8 years ago

To make it work on Lumen I had to perform an extra step : I edited /app/Console/Kernel.php and added public function bootstrap() {} There is probably a better way but I just wanted it to work.

Thanks to you.

rndmerle commented 8 years ago

Well, obviously the Lumen integration is not flawless because it was not the point, or I'm just screwing up idk. But just for you information $this->laravel->artisan and using() work wonder, but $this->laravel->get() throws :

an uncaught exception has been thrown in /tmp/kahlan/vendor/laravel/framework/src/Illuminate/Container/Container.php line 748

  message:Illuminate\Contracts\Container\BindingResolutionException Code(0) with message "Target [Illuminate\\Contracts\\Http\\Kernel] is not instantiable."

    [NA] - /tmp/kahlan/home/ansett/Dev/BeauteResearch/contract/vendor/laravel/framework/src/Illuminate/Container/Container.php, line  to 748
    Illuminate\Container\Container::build() - /tmp/kahlan/home/ansett/Dev/BeauteResearch/contract/vendor/laravel/framework/src/Illuminate/Container/Container.php, line 629
    Illuminate\Container\Container::make() - /tmp/kahlan/home/ansett/Dev/BeauteResearch/contract/vendor/laravel/lumen-framework/src/Application.php, line 206
    Laravel\Lumen\Application::make() - /tmp/kahlan/home/ansett/Dev/BeauteResearch/contract/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php, line 504
    Sofa\LaravelKahlan\Laravel::call() - /tmp/kahlan/home/ansett/Dev/BeauteResearch/contract/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php, line 110
    Sofa\LaravelKahlan\Laravel::get() - /home/ansett/Dev/BeauteResearch/contract/spec/ContractSpec.php, line 27
    Kahlan\Specification::run() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Specification.php, line 101
    Kahlan\Specification::process() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Suite.php, line 327
    Kahlan\Suite::process() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Suite.php, line 327
    Kahlan\Suite::process() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Suite.php, line 327
    Kahlan\Suite::process() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Suite.php, line 444
    Kahlan\Suite::run() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Cli/Kahlan.php, line 572
    Kahlan\Filter\Filter::on() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Cli/Kahlan.php, line 574
    Kahlan\Cli\Kahlan::_run() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Cli/Kahlan.php, line 363
    Kahlan\Filter\Filter::on() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/src/Cli/Kahlan.php, line 371
    Kahlan\Cli\Kahlan::run() - /home/ansett/Dev/BeauteResearch/contract/vendor/crysalead/kahlan/bin/kahlan, line 47
jarektkaczyk commented 8 years ago

@rndmerle Lumen has its own testing features built into the TestCase, that are a bit lighter version of the Laravel's one. Unfortunately the difference makes it impossible to make it work with both, so I guess the only way is to create another branch that will work with lumen.

I will try to find a while to play with it, meanwhile feel free to fork and do that! You'd need copy Laravel.php class to Lumen.php and make it a functional copy of the Lumen's TestCase: https://github.com/laravel/lumen-framework/blob/5.2/src/Testing/TestCase.php#L13

Get back to me with results. thx

rndmerle commented 8 years ago

Ok I get it now, thanks.

I might give it a go later but for now I'm late on my project I'm sorry.