Vano
Vano

Reputation: 43

PHPunit not working in 'artisan tinker' in Laravel

I'm doing a tutorial on Laracast to learn Laravel. Now I'm kind of stuck on one part which I don't want to skip (first 40 seconds).

The problem is when I open PHP artisan tinker and do the command: phpunit (or vendor/bin/phpunit) it gives me the error:

PHP Notice:  Use of undefined constant phpunit - assumed 'phpunit' in /var/www/vhosts/web-wings.nl/roylar.web-wings.nleval()'d code on line 1

and

PHP Notice:  Use of undefined constant vendor - assumed 'vendor' in /var/www/vhosts/web-wings.nl/roylar.web-wings.nleval()'d code on line 1

Also when I try

phpunit tests/Unit/ExampleTest.php 

It gives the error:

PHP Parse error: Syntax error, unexpected T_STRING on line 1

So there's definitely something wrong with phpunit but I can't find the answer. I looked into the tutorial's comments, Youtube and Google but nothing.

Upvotes: 0

Views: 462

Answers (1)

Jignesh Joisar
Jignesh Joisar

Reputation: 15115

nothing wrong with phpunit you just test without using php artisan tinker because the tinker command uses the PsySH library to setup a REPL (read-eval print loop) environment within the context of your Laravel application

Upvotes: 1

Related Questions