phpunit testing cannot find file and cannot test globally

Published 5 months ago by Webiondev123

I am unable to run phpunit test from root folder but when I change to vender/bin I can run phpunit but cannot test. It says cannot open file

c:\wamp64\www\fundtheneedy>phpunit
'phpunit' is not recognized as an internal or external command,
operable program or batch file.


c:\wamp64\www\fundtheneedy\vendor\bin>phpunit ExampleTest


Cannot open file "ExampleTest.php".
Best Answer (As Selected By Webiondev123)
tykus

Actually missed the c:\ bit... I don't use Windows, so not sure what the optimal solution might be for a local project installation.

I would think that you could install PHPUnit globally and ensuring that the composer/bin directory in your User directory is included in your PATH, you could use phpunit anywhere throughout your system.

tykus
tykus
5 months ago (699,130 XP)

You can run your full test suite if you run the following from the commandline

$ vendor/bin/phpunit

You can alias this to phpunit in your .bashrc or .zshrc file so that it is available in the root of any project:

alias phpunit="vendor/bin/phpunit"
Webiondev123

From windows command line it givs

c:\wamp64\www\fundtheneedy>vendor/bin/phpunit
'vendor' is not recognized as an internal or external command,
operable program or batch file.

Also where do I create .bashrc file? in my root laravel app? That makes it .bashrc.sh which I tried but still not working

tykus
tykus
5 months ago (699,130 XP)

Actually missed the c:\ bit... I don't use Windows, so not sure what the optimal solution might be for a local project installation.

I would think that you could install PHPUnit globally and ensuring that the composer/bin directory in your User directory is included in your PATH, you could use phpunit anywhere throughout your system.

Please sign in or create an account to participate in this conversation.