user1901469
user1901469

Reputation: 1249

symfony css-selector is not installed

When I try to use phpunit I get the following error on one of my tests

RuntimeException: Unable to filter with a CSS selector as the Symfony CssSelector is not installed (you can use filterXPath instead).

I have symfony/css-selector in both the require and require dev sections and neither seems to help phpunit detect the package.

I assume I need to activate it somewhere. Has anyone had this problem before or know how to fix it? Thanks

Edit: The test itself is just a simple test to get everything working correctly

The test is just a simple example test meant to make sure things are working. The form has one field, a text box called title, and a submit button. When this test is ran the css-selector error is shown.

public function test_fill_out_project_create_form()
    {
                $this->visit('project/create')
                ->type('TEST12345','title')
                ->press('Save')
                ->seePageIs('project/')
                ->see('TEST12345');        
    }

Upvotes: 2

Views: 3634

Answers (3)

Igor Pantović
Igor Pantović

Reputation: 9246

I think Symfony standard edition does not come with CSS Selector component , you can install it fairly easy though:

composer require symfony/css-selector

Upvotes: 1

simo
simo

Reputation: 24590

I had the same issue, I tried:

composer require symfony/symfony

then, it worked, but I will be using it only for require-dev

Upvotes: 0

user1901469
user1901469

Reputation: 1249

I ended up having to clear out all of my composer dependencies and cache then re installing everything to fix this issue.

My best guess at the problem was a symlink between the host codebase and the Homestead VM that was actually hosting the code.

Upvotes: 0

Related Questions