Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch exception in detectLineNumber for not existing blade files. #299

Merged
merged 1 commit into from Aug 1, 2020

Conversation

cbl
Copy link
Contributor

@cbl cbl commented Jul 31, 2020

I stumbled over this while testing mocked blade views. In that case I just want to test the compiled view without having an existing template file. Whenever there is an exception in the view, detectLineNumber in Facade\Ignition\Views\Compilers\BladeSourceMapCompiler fails, since it cannot open the view path. However I would like to see the exceptions in my views anyway. I suggest to return line number 1 in that case.

This is the exception I get when I render mocked blade templates:

Caused by
ErrorException: file_get_contents(/Users/helen/git/cbl/loewe/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php(34) : eval()'d code): failed to open stream: No such file or directory

/Users/helen/git/dev-ui-kit/packages/fjord-ui-kit/vendor/facade/ignition/src/Views/Compilers/BladeSourceMapCompiler.php:13
/Users/helen/git/dev-ui-kit/packages/fjord-ui-kit/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php:98
...

With catching the ErrorException:

Caused by
Mockery\Exception\BadMethodCallException: Received Mockery_2_Fjord_Crud_Models_Media::offsetExists(), but no expectations were specified

/Users/helen/git/dev-ui-kit/packages/fjord-ui-kit/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1701
/Users/helen/git/dev-ui-kit/packages/fjord-ui-kit/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:41
...

@freekmurze freekmurze merged commit ce1b2b8 into facade:master Aug 1, 2020
@freekmurze
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants