Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run PHPUnit in Laravel from my Windows Command prompt

I have a Laravel app installed in my directory f:\lara_app. I use PHP artisan serve to run the app. I have Laravel version 5.4.36 (via Composer Install)

I am not trying my hand in using the PHP Unit to do testing. Inside f:/lara_app/tests/Unit/ExampleTest.php, I have the following codes:

namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class ExampleTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
         $this->assertTrue(true);
    }

    public function myFirstTest()
    {
        $value = 'Hello World';
        $this->assertTrue( 'Hello' === $value, 'Value should be Hello World');
    }     
}

I now try to run the test from my command prompt:

f:\lara_app> .vendor/phpunit/phpuni/phpunit

But I'm getting the message below:

'.vendor' is not recognized as an internal or external command, operable program or batch file

How do I run the PHPUnit test?

Thanks in advance

like image 399
Jaime Dolor jr. Avatar asked Jun 29 '18 02:06

Jaime Dolor jr.


People also ask

How do I run a PHPUnit test?

How to Run Tests in PHPUnit. You can run all the tests in a directory using the PHPUnit binary installed in your vendor folder. You can also run a single test by providing the path to the test file. You use the --verbose flag to get more information on the test status.


1 Answers

Use quotes:

"./vendor/bin/phpunit"
like image 185
Nikolay Oskin Avatar answered Oct 31 '22 21:10

Nikolay Oskin