@beforeClass

@beforeClass

The @beforeClass annotation can be used to specify static methods that should be called before any test methods in a test class are run to set up shared fixtures.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use PHPUnit\Framework\TestCase;
 
class MyTest extends TestCase
{
    /**
     * @beforeClass
     */
    public static function setUpSomeSharedFixtures()
    {
        // ...
    }
 
    /**
     * @beforeClass
     */
    public static function setUpSomeOtherSharedFixtures()
    {
        // ...
    }
}
doc_PHPUnit
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.