ksome
ksome

Reputation: 307

Running tests in PhpStorm for Laravel after migrating to Homestead

I've migrated my project from a classic installation to Homestead as described on the Laravel-Homepage. Everything works fine, except for my test cases.

The output is as follows:

[vagrant:///Users/<username>/Homestead]:/usr/bin/php /home/vagrant/<projectname>/vendor/phpunit/phpunit/phpunit --configuration /home/vagrant/<projectname>/phpunit.xml --filter Tests\\Feature\\LoggingTest --test-suffix LoggingTest.php /Users/<username>/projects/<projectname>/tests/Feature --teamcity
Cannot open file "/Users/<username>/projects/<projectname>/tests/Feature.php".

So my question is, where do I change in PhpStorm the last path from

/Users/<username>/projects/<projectname>/tests/Feature

to

/home/vagrant/<projectname>/tests/Feature

or even better remove it entirely, because that file does not exist anyway?

The tests worked fine just before migrating, so what did I miss?

This is my Homestead.yaml:

ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: parallels

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/projects/<projectname>
      to: /home/vagrant/<projectname>
      type: "nfs"

    - map: ~/projects/php
      to: /home/vagrant/php
      type: "nfs"

sites:
    - map: homestead.local
      to: /home/vagrant/<projectname>/public
      type: "laravel"

databases:
    - <correct_database_name>

features:
    - mysql: true
    - mariadb: false
    - ohmyzsh: true
    - webdriver: false

Upvotes: 0

Views: 128

Answers (1)

ksome
ksome

Reputation: 307

The solution was to add the tests-directory to the path mappings in the PHPStorm preferences.

Go to:

Preferences->Languages & Frameworks->PHP

Then unter "Path mappings:" click on the folder icon.

There add manually via the plus-button the local path:

/Users/<username>/projects/<projectname>/tests

and the remote path:

/home/vagrant/<projectname>/tests

Upvotes: 1

Related Questions