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

After First Test | Fatal error: During class fetch: Uncaught ErrorException #24

Open
StanBarrows opened this issue Apr 11, 2021 · 1 comment

Comments

@StanBarrows
Copy link

StanBarrows commented Apr 11, 2021

Hey everyone

I'm experiencing a Fatal error:
During class fetch: Uncaught ErrorException: Required parameter $method follows optional parameter expectation
The message shows on a simple index resource test. Any idea what I'm missing? I can see there is a xdebug error but I'm not sure if it's related to the package or the exception.

Every PHPUnit and Pest tests beside are working thine.


  Tests:  1 risked, 51 passed
  Time:   3.08s

UserResourceTest.php

<?php

namespace Tests\Nova;

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Auth;
use Tests\TestCase;
use NovaTesting\NovaAssertions;

class UserResourceTest extends TestCase
{
    use NovaAssertions;
    use RefreshDatabase;

    /**
     * A basic test example.
     *
     * @return void
     */

    public function test_render_users_index_resource_page()
    {
        $this->withoutExceptionHandling();
        $user = User::factory()->create();
        Auth::login($user);
        $response = $this->novaIndex('users');
        $response->assertOk();


    }
}

PHP -v

Zend Engine v4.0.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.2, Copyright (c), by Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans

Exception

/opt/homebrew/bin/php /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/phpunit --configuration /Users/sebastian/Development/fresh-smarango/phpunit.xml --filter "/(Tests\\Nova\\UserResourceTest::test_render_users_index_resource_page)( .*)?$/" --test-suffix UserResourceTest.php /Users/sebastian/Development/fresh-smarango/tests/Nova --teamcity
Testing started at 22:07 ...
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.


Fatal error: During class fetch: Uncaught ErrorException: Required parameter $method follows optional parameter $value in /Users/sebastian/Development/fresh-smarango/vendor/dillingham/nova-assertions/src/Assert/AssertFields.php:47
Stack trace:
#0 /Users/sebastian/Development/fresh-smarango/vendor/composer/ClassLoader.php(476): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'Required parame...', '/Users/sebastia...', 47)
#1 /Users/sebastian/Development/fresh-smarango/vendor/composer/ClassLoader.php(476): include()
#2 /Users/sebastian/Development/fresh-smarango/vendor/composer/ClassLoader.php(344): Composer\Autoload\includeFile('/Users/sebastia...')
#3 /Users/sebastian/Development/fresh-smarango/vendor/dillingham/nova-assertions/src/NovaResponse.php(17): Composer\Autoload\ClassLoader->loadClass('NovaTesting\\Ass...')
#4 /Users/sebastian/Development/fresh-smarango/vendor/composer/ClassLoader.php(476): include('/Users/sebastia...')
#5 /Users/sebastian/Development/fresh-smarango/vendor/composer/ClassLoader.php(344): Composer\Autoload\includeFile('/Users/sebastia...')
#6 /Users/sebastian/Development/fresh-smarango/vendor/dillingham/nova-assertions/src/NovaAssertions.php(18): Composer\Autoload\ClassLoader->loadClass('NovaTesting\\Nov...')
#7 /Users/sebastian/Development/fresh-smarango/tests/Nova/UserResourceTest.php(27): Tests\Nova\UserResourceTest->novaIndex('users')
#8 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/Framework/TestCase.php(1526): Tests\Nova\UserResourceTest->test_render_users_index_resource_page()
#9 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/Framework/TestCase.php(1132): PHPUnit\Framework\TestCase->runTest()
#10 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/Framework/TestResult.php(722): PHPUnit\Framework\TestCase->runBare()
#11 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/Framework/TestCase.php(884): PHPUnit\Framework\TestResult->run(Object(Tests\Nova\UserResourceTest))
#12 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/Framework/TestSuite.php(677): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#13 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/Framework/TestSuite.php(677): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#14 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(667): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#15 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/TextUI/Command.php(143): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
#16 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/src/TextUI/Command.php(96): PHPUnit\TextUI\Command->run(Array, true)
#17 /Users/sebastian/Development/fresh-smarango/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#18 {main} in /Users/sebastian/Development/fresh-smarango/vendor/dillingham/nova-assertions/src/NovaResponse.php on line 17

Fatal error: Uncaught ErrorException: Function must be enabled in php.ini by setting 'xdebug.mode' to 'develop' in /Users/sebastian/Development/fresh-smarango/vendor/symfony/error-handler/Error/FatalError.php:37
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Function must b...', '/Users/sebastia...', 37)
#1 /Users/sebastian/Development/fresh-smarango/vendor/symfony/error-handler/Error/FatalError.php(37): xdebug_get_function_stack()
#2 /Users/sebastian/Development/fresh-smarango/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(143): Symfony\Component\ErrorHandler\Error\FatalError->__construct('During class fe...', 0, Array, 0)
#3 /Users/sebastian/Development/fresh-smarango/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(130): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalErrorFromPhpError(Array, 0)
#4 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#5 {main}
  thrown in /Users/sebastian/Development/fresh-smarango/vendor/symfony/error-handler/Error/FatalError.php on line 37

Process finished with exit code 255
@khaled-dev
Copy link
Contributor

i made a pr for this issue #25

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

No branches or pull requests

2 participants