PHPUnit Manual
Edition for PHPUnit 12.5. Updated on Dec 11, 2025.
Sebastian Bergmann
This work is licensed under the Creative Commons Attribution 3.0 Unported License.
Contents:
Appendix
- 1. Assertions
- Static vs. Non-Static Usage of Assertion Methods
- Boolean
- Identity
- Equality
- Iterable
assertArrayHasKey()assertContains()assertContainsOnly()assertContainsOnlyArray()assertContainsOnlyBool()assertContainsOnlyCallable()assertContainsOnlyFloat()assertContainsOnlyInt()assertContainsOnlyIterable()assertContainsOnlyNull()assertContainsOnlyNumeric()assertContainsOnlyObject()assertContainsOnlyResource()assertContainsOnlyClosedResource()assertContainsOnlyScalar()assertContainsOnlyString()assertContainsOnlyInstancesOf()
- Objects
- Cardinality
- Types
- Strings
assertStringStartsWith()assertStringEndsWith()assertStringContainsString()assertStringContainsStringIgnoringCase()assertStringEqualsStringIgnoringLineEndings()assertMatchesRegularExpression()assertStringMatchesFormat()assertStringMatchesFormatFile()assertFileMatchesFormat()assertFileMatchesFormatFile()assertStringEqualsFile()
- JSON
- XML
- Filesystem
- Math
- Constraints
- 2. Attributes
- 3. Events
- 4. The XML Configuration File
- The
<phpunit>Element- The
backupGlobalsAttribute - The
backupStaticPropertiesAttribute - The
bootstrapAttribute - The
cacheDirectoryAttribute - The
cacheResultAttribute - The
colorsAttribute - The
columnsAttribute - The
controlGarbageCollectorAttribute - The
numberOfTestsBeforeGarbageCollectionAttribute - The
requireCoverageMetadataAttribute - The
processIsolationAttribute - The
stopOnDefectAttribute - The
stopOnErrorAttribute - The
stopOnFailureAttribute - The
stopOnWarningAttribute - The
stopOnRiskyAttribute - The
stopOnDeprecationAttribute - The
stopOnNoticeAttribute - The
stopOnSkippedAttribute - The
stopOnIncompleteAttribute - The
failOnAllIssuesAttribute - The
failOnEmptyTestSuiteAttribute - The
failOnWarningAttribute - The
failOnRiskyAttribute - The
failOnDeprecationAttribute - The
failOnPhpunitDeprecationAttribute - The
failOnNoticeAttribute - The
failOnSkippedAttribute - The
failOnIncompleteAttribute - The
beStrictAboutChangesToGlobalStateAttribute - The
beStrictAboutOutputDuringTestsAttribute - The
beStrictAboutTestsThatDoNotTestAnythingAttribute - The
beStrictAboutCoverageMetadataAttribute - The
enforceTimeLimitAttribute - The
defaultTimeLimitAttribute - The
timeoutForSmallTestsAttribute - The
timeoutForMediumTestsAttribute - The
timeoutForLargeTestsAttribute - The
defaultTestSuiteAttribute - The
stderrAttribute - The
reverseDefectListAttribute - The
registerMockObjectsFromTestArgumentsRecursivelyAttribute - The
extensionsDirectoryAttribute - The
executionOrderAttribute - The
resolveDependenciesAttribute - The
testdoxAttribute - The
testdoxSummaryAttribute - The
displayDetailsOnAllIssuesAttribute - The
displayDetailsOnIncompleteTestsAttribute - The
displayDetailsOnSkippedTestsAttribute - The
displayDetailsOnTestsThatTriggerDeprecationsAttribute - The
displayDetailsOnPhpunitDeprecationsAttribute - The
displayDetailsOnTestsThatTriggerErrorsAttribute - The
displayDetailsOnTestsThatTriggerNoticesAttribute - The
displayDetailsOnTestsThatTriggerWarningsAttribute - The
shortenArraysForExportThresholdAttribute
- The
- The
<testsuites>Element - The
<source>Element- The
<include>Element - The
<exclude>Element - The
<directory>Element - The
<file>Element - The
<deprecationTrigger>Element - The
<ignoreSelfDeprecations>Attribute - The
<ignoreDirectDeprecations>Attribute - The
<ignoreIndirectDeprecations>Attribute - The
<restrictNotices>Attribute - The
<restrictWarnings>Attribute - The
<baseline>Attribute - The
<ignoreSuppressionOfDeprecations>Attribute - The
<ignoreSuppressionOfPhpDeprecations>Attribute - The
<ignoreSuppressionOfErrors>Attribute - The
<ignoreSuppressionOfNotices>Attribute - The
<ignoreSuppressionOfPhpNotices>Attribute - The
<ignoreSuppressionOfWarnings>Attribute - The
<ignoreSuppressionOfPhpWarnings>Attribute
- The
- The
<coverage>Element - The
<logging>Element - The
<groups>Element - The
<extensions>Element - The
<php>Element
- The
- 5. Copyright