1
votes

What is this error? How to create simple test in laravel.

PHPUnit 6.3.1 by Sebastian Bergmann and contributors.

Time: 130 ms, Memory: 4.00MB

No tests executed!

tests/Feature/ReadArticle.php

<?php

namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class ReadArticle extends TestCase
{
    /**
     * @test
     */
    public function a_user_can_view_home_page()
    {
        $this->get('/')->assertSee('وبسایت اکسبیر');
    }
}
2
how you run the test? what is the command you executed?Shiro
composer global require phpunit/phpunituser9085794
run ./vendor/bin/phpunit in your project folder. The version from your global phpunit might not same as your project require version.Shiro

2 Answers

9
votes

If you used cmd line enter: "./vendor/bin/phpunit" to the root application. Don't forget about quotes!

4
votes

2 possibilities :

Your test have to be

class ReadArticleTest extends TestCase

And so is your file name

You might use your global PHPunit instead of the laravel one.

Try this :

./vendor/bin/phpunit