Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

depends in phpunit doesn't seem to be working

Maybe it's just me but @depends doesn't seem to be working as I'd expect it to. My code:

<?php
use PHPUnit\Framework\TestCase;

class MyTest extends TestCase
{
    /*
     * @depends testFunc1
     */
    public function testFunc2()
    {
        exit('TEST FUNC 2 called');
    }

    public function testFunc1()
    {
        exit('TEST FUNC 1 called');
    }
}

When I do phpunit MyTest.php I'd expect to see TEST FUNC 1 called but instead I see TEST FUNC 2 called. As is it seems to just be running the tests in the order they appear in the script, regardless of the @depends attribute, which really begs the question: what does @depends actually do?

I'm running PHPUnit 5.7.20.

like image 529
neubert Avatar asked Dec 23 '22 16:12

neubert


1 Answers

You need to use /** instead of /* to start a docblock.

like image 131
Sebastian Bergmann Avatar answered Jan 08 '23 06:01

Sebastian Bergmann