dimanche 6 août 2017

PHPUnit not running all tests when I try to test a file upload in Laravel

I've got a test in Laravel that tests file uploads like this:

public function testStorePdf()
{
    $path = __DIR__ . '/testFile/test.pdf';
    $name = 'test.pdf';
    $file = new UploadedFile($path, $name, 'application/pdf', filesize($path), null, true);
    $response = $this->post(
        action('FileController@store'),
        ['file' => $file]
    );

    $response->assertStatus(200);
}

It's using an UploadFile in testing mode like I've seen on other questions. When I run PHPUnit, it only returns a message of "OK" without actually doing any of my other tests or printing coverage:

$ vendor/bin/phpunit
PHPUnit 5.7.21 by Sebastian Bergmann and contributors.

OK

When I comment out the actual post call to the FileController in this method, all my other tests run and coverage is printed as I expect.

Any idea why PHPUnit is responding like this instead of running all my tests?

Aucun commentaire:

Enregistrer un commentaire