0
votes

I am having trouble with testing a simple laravel project. Laravel version is 5.1 and PHPUnit version is 5.2.4. Example:

<?php
class MissionTest extends TestCase {
    /*
     * @test
     */
    public function f1() {
        return [];
    }

    /*
     * @test
     * @depends f1
     */
    public function f2($a) {
        dd($a);
    }

    public function testF1() {
        return [];
    }

    /*
     * @depends testF1
     */
    public function testF2($a) {
        dd($a);
    }
}
?>

The expected behaviour would be to execute f1 print one fullstop then f2 and output an empty array. What actually happens is that tests f1 and f2 are ignored, testF1 is executed resulting in one fullstop and then testF2 is executed resulting in one E. The exception is:

ErrorException: Missing argument 1 for MissionTest::testF2()

I just started working with PHPUnit and no matter what I've tried I couldn't get it to work as expected. Any help will be greatly appreciated.

Edit: Forgot to mention that TestCase extends Illuminate\Foundation\Testing\TestCase and simply overrides the createApplication method.

1

1 Answers

2
votes

This is how it works. Check the documentation. It highlights:

A doc comment in PHP must start with /** and end with */. Annotations in any other style of comment will be ignored.