PHPUnit can perform additional checks while it executes the tests. In
addition to the fine-grained control over the various strict mode checks
(see below) you may use the --strict commandline option
or set strict="true" in PHPUnit's XML configuration file
to enable all of them.
PHPUnit can be strict about tests that do not test anything. This check
can be enabled by using the --report-useless-tests
option on the commandline or by setting
beStrictAboutTestsThatDoNotTestAnything="true" in
PHPUnit's XML configuration file.
A test that that does not perform an assertion will be marked as risky
when this check is enabled. Expectations on mock objects or annotations
such as @expectedException count as an assertion.
PHPUnit can be strict about unintentionally covered code. This check
can be enabled by using the --strict-coverage option on
the commandline or by setting
checkForUnintentionallyCoveredCode="true" in PHPUnit's
XML configuration file.
A test that is annotated with @covers and executes code that
is not listed using a @covers or @uses
annotation will be marked as risky when this check is enabled.
PHPUnit can be strict about output during tests. This check can be enabled
by using the --disallow-test-output option on the
commandline or by setting
beStrictAboutOutputDuringTests="true" in PHPUnit's XML
configuration file.
A test that emits output, for instance by invoking print in
either the test code or the tested code, will be marked as risky when this
check is enabled.
PHP_Invoker パッケージがインストールされており、
かつ pcntl 拡張モジュールが利用可能な場合は、
テストの実行時間に制限を設けることができます。
The enforcing of this
time limit can be enabled by using the
--enforce-time-limit option on the commandline or by
setting beStrictAboutTestSize="true" in PHPUnit's XML
configuration file.
@large とマークされたテストは、
実行時間が 60 秒を超えたら失敗します。
このタイムアウト時間は、XML 設定ファイルの
timeoutForLargeTests 属性で変更できます。
@medium とマークされたテストは、
実行時間が 10 秒を超えたら失敗します。
このタイムアウト時間は、XML 設定ファイルの
timeoutForMediumTests 属性で変更できます。
@medium とも @large ともマークされていないテストは、
@small とマークされたものとみなします。
このテストは、実行時間が 1 秒を超えたら失敗します。
このタイムアウト時間は、XML 設定ファイルの
timeoutForSmallTests 属性で変更できます。