@medium

@medium The @medium annotation is an alias for @group medium. A medium test must not depend on a test marked as @large. If the PHP_Invoker package is installed and strict mode is enabled, a medium test will fail if it takes longer than 10 seconds to execute. This timeout is configurable via the timeoutForMediumTests attribute in the XML configuration file.

@large

@large The @large annotation is an alias for @group large. If the PHP_Invoker package is installed and strict mode is enabled, a large test will fail if it takes longer than 60 seconds to execute. This timeout is configurable via the timeoutForLargeTests attribute in the XML configuration file.

@group

@group A test can be tagged as belonging to one or more groups using the @group annotation like this use PHPUnit\Framework\TestCase; class MyTest extends TestCase { /** * @group specification */ public function testSomething() { } /** * @group regresssion * @group bug2204 */ public function testSomethingElse() { } } Tests can be selected for execution based on groups using the --group and --exclude-group options of the command-line

@expectedExceptionMessageRegExp

@expectedExceptionMessageRegExp The expected message can also be specified as a regular expression using the @expectedExceptionMessageRegExp annotation. This is helpful for situations where a substring is not adequate for matching a given message. use PHPUnit\Framework\TestCase; class MyTest extends TestCase { /** * @expectedException MyException * @expectedExceptionMessageRegExp /Argument \d+ can not be an? \w+/ */ public function testExceptionHasRi

@expectedExceptionMessage

@expectedExceptionMessage The @expectedExceptionMessage annotation works similar to @expectedExceptionCode as it lets you make an assertion on the error message of an exception. use PHPUnit\Framework\TestCase; class MyTest extends TestCase { /** * @expectedException MyException * @expectedExceptionMessage Some Message */ public function testExceptionHasRightMessage() { throw new MyException('Some Message', 20); } } The expected message can be a

@expectedExceptionCode

@expectedExceptionCode The @expectedExceptionCode annotation, in conjunction with the @expectedException allows making assertions on the error code of a thrown exception thus being able to narrow down a specific exception. use PHPUnit\Framework\TestCase; class MyTest extends TestCase { /** * @expectedException MyException * @expectedExceptionCode 20 */ public function testExceptionHasErrorcode20() { throw new MyException('Some Message', 20); } } T

@expectedException

@expectedException Example 2.10 shows how to use the @expectedException annotation to test whether an exception is thrown inside the tested code. See the section called “Testing Exceptions” for more details.

@depends

@depends PHPUnit supports the declaration of explicit dependencies between test methods. Such dependencies do not define the order in which the test methods are to be executed but they allow the returning of an instance of the test fixture by a producer and passing it to the dependent consumers. Example 2.2 shows how to use the @depends annotation to express dependencies between test methods. See the section called “Test Dependencies” for more details.

@dataProvider

@dataProvider A test method can accept arbitrary arguments. These arguments are to be provided by a data provider method (provider() in Example 2.5). The data provider method to be used is specified using the @dataProvider annotation. See the section called “Data Providers” for more details.

@coversNothing

@coversNothing The @coversNothing annotation can be used in the test code to specify that no code coverage information will be recorded for the annotated test case. This can be used for integration testing. See Example 11.3 for an example. The annotation can be used on the class and the method level and will override any @covers tags.