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

Too few arguments to function setUpTheTestEnvironmentTraits() #58

Open
hatamiarash7 opened this issue Jun 3, 2019 · 4 comments
Open

Comments

@hatamiarash7
Copy link
Contributor

hatamiarash7 commented Jun 3, 2019

I'm running this library in Laravel 5.8

There is a problem with arguments. steward return fatal error and after many search saw this error in logs :

There was 1 error:

1) Tests\SeleniumExampleTest::testExample
ArgumentCountError: Too few arguments to function Modelizer\Selenium\SeleniumTestCase::setUpTheTestEnvironmentTraits(), 
0 passed in C:\<project>\vendor\modelizer\selenium\src\SeleniumTestCase.php on line 71 and exactly 1 expected

So i saw SeleniumTestCase.php and line 71 :

return $this->setUpTheTestEnvironmentTraits();

The setUpTheTestEnvironmentTraits() method from Testing trait, need at lease one argument as array. You can see below :

final protected function setUpTheTestEnvironmentTraits(array $uses): array
    {
        if (isset($uses[RefreshDatabase::class])) {
            $this->refreshDatabase();
        }

        if (isset($uses[DatabaseMigrations::class])) {
            $this->runDatabaseMigrations();
        }

        if (isset($uses[DatabaseTransactions::class])) {
            $this->beginDatabaseTransaction();
        }

        if (isset($uses[WithoutMiddleware::class])) {
            $this->disableMiddlewareForAllTests();
        }

        if (isset($uses[WithoutEvents::class])) {
            $this->disableEventsForAllTests();
        }

        if (isset($uses[WithFaker::class])) {
            $this->setUpFaker();
        }

        return $uses;
    }

I fixed this error by editing SeleniumTestCase.php and change line 71 as follow :

return $this->setUpTheTestEnvironmentTraits([]);

But i think you should check these process because there is serious problems

@devtripleplus
Copy link

Hey @hatamiarash7, Did you find any solution for the same.

I am also getting same issue:

Tests\SeleniumTestExample> ArgumentCountError: Too few arguments to function Modelizer\Selenium\SeleniumTestCase::setUpTheTestEnvironmentTraits(), 0 passed in C:\Users\test\Desktop\websites\laravel\demo-task-list\vendor\modelizer\selenium\src\SeleniumTestCase.php on line 70 and exactly 1 expected

@hatamiarash7
Copy link
Contributor Author

@devtripleplus Sorry i can't remember :))) It's an old issue

@devtripleplus
Copy link

devtripleplus commented Jul 2, 2020

@hatamiarash7 Do you have any idea how to implement selenium in laravel

@hatamiarash7
Copy link
Contributor Author

@devtripleplus You can use Laravel Dusk. It's much better

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