butschster / LaravelMetaTags

The most powerful and extendable tools for managing SEO Meta Tags in your Laravel project
MIT License
540 stars 50 forks source link

phpunit tests fail when @meta_tags is in a view #4

Closed SvanThuijl closed 4 years ago

SvanThuijl commented 4 years ago

I'm using this package for a while which works great. Now I am writing tests for my application but they fail when @meta_tags is present in the view.

Any idea how to resolve this?

I already tried to to remove all meta data in my custom code. This does not resolve the issue.

The exception

(1/1) InvalidArgumentException
Action Facade\Ignition\Http\Controllers\ShareReportController not defined.

The test

    public function testBasicTest()
    {
//        $this->withExceptionHandling();
        $response = $this->get('/');
        $response->dump();

        $response->assertStatus(200);
    }

Php unit result

F                                                                  2 / 2 (100%)

Time: 278 ms, Memory: 28.00 MB

There was 1 failure:

1) Tests\Feature\ExampleTest::testBasicTest
Expected status code 200 but received 500.
Failed asserting that false is true.

/Users/simonvanthuijl/PhpstormProjects/gv/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:166
/Users/simonvanthuijl/PhpstormProjects/gv/tests/Feature/ExampleTest.php:21

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.
Simons-MacBook-Pro:gv simonvanthuijl$ 

html output from the dump function

Screen Shot 2019-10-22 at 00 20 29
butschster commented 4 years ago

Hello! Sorry for long answer.

Try to check

SvanThuijl commented 4 years ago

The issue has been resolved. I updates all dependencies so I am not sure if it was your package. I've seen issues with other packages with he same error so could have been a Laravel issue.

butschster commented 4 years ago

The issue has been resolved. I updates all dependencies so I am not sure if it was your package. I've seen issues with other packages with he same error so could have been a Laravel issue.

It was also my fault. I didn't register service containers when application started in console. Thank you for your issue.

If you will have questions and sugestions, welcome!