I'm developing a Laravel package and I'm trying to figure out how to test with PhpUnit, a Blade view that contains @include or @extend directives.
This is the structure of the package resource folder:
resources
-- views
---- create.blade.php
---- edit.blade.php
---- layout.blade.php
The create and edit views start extending the layout one.
@extends('vendor.laravel-responsive-gallery.layout')
When I install the package in an application and publish the views this works fine, but when I'm in the test environment and I run PhpUnit i get the error.
The response is not a view.
This because PhpUnit cannot resolve the address of the view.
I have tried also with this approach to avoid testing that line of code.
@if (env('APP_ENV')!='testing')
@extends('vendor.laravel-responsive-gallery.layout')
@endif
But I PhpUnit throw again the same error.
Since is not possible to assign a relative path to an @extends or @include directive, do you know how can I test my view without commenting this @extends line?
I've checked already on Stack overflow and on the Internet but I didn't find any mention to this.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire