PrinceMinky's avatar

Thread Test error.

I am running a test, as featured on one of the series. But I'm not getting the same errors.

For some reason my the test 'a_user_can_browse_threads' isn't found even though it is clearly there. Have I missed something?

[all errors and code] "Mikey@Home MINGW64 /c/wamp/projects/forum $ phpunit PHPUnit 6.4.4 by Sebastian Bergmann and contributors.

W. 2 / 2 (100%)

Time: 203 ms, Memory: 10.00MB

There was 1 warning:

  1. Warning No tests found in class "Tests\Feature\ThreadsTest".

WARNINGS! Tests: 2, Assertions: 1, Warnings: 1."


namespace Tests\Feature;

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

class ThreadsTest extends TestCase
{
    use DatabaseMigrations;

    /**
     *  Test 
     */
    public function a_user_can_browse_threads()
    {
        $response = $this->get('/threads');

        $response->assertStatus(200);
    }
}
0 likes
3 replies
PrinceMinky's avatar
PrinceMinky
OP
Best Answer
Level 11

I got it to work. For some reason the function wasn't being recognised. I applied "test_" at the beginning of the function and it worked.


namespace Tests\Feature;

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

class ThreadsTest extends TestCase
{
    use DatabaseMigrations;

    /**
     *  Test
     */
    public function test_a_user_can_browse_threads()
    {
        $response = $this->get('/threads');

        $response->assertStatus(200);
    }
}
4 likes

Please or to participate in this conversation.