PHPUnit
  • 1. Installing PHPUnit
    • Requirements
    • PHP Archive (PHAR)
      • Verifying PHPUnit PHAR Releases
    • Composer
    • Global Installation
    • Webserver
  • 2. Writing Tests for PHPUnit
    • Test Dependencies
    • Data Providers
    • Testing Exceptions
    • Testing PHP Errors, Warnings, and Notices
    • Testing Output
    • Error output
      • Edge cases
  • 3. The Command-Line Test Runner
    • Command-Line Options
    • TestDox
  • 4. Fixtures
    • More setUp() than tearDown()
    • Variations
    • Sharing Fixture
    • Global State
  • 5. Organizing Tests
    • Composing a Test Suite Using the Filesystem
    • Composing a Test Suite Using XML Configuration
  • 6. Risky Tests
    • Useless Tests
    • Unintentionally Covered Code
    • Output During Test Execution
    • Test Execution Timeout
    • Global State Manipulation
  • 7. Incomplete and Skipped Tests
    • Incomplete Tests
    • Skipping Tests
    • Skipping Tests using @requires
  • 8. Test Doubles
    • Stubs
    • Mock Objects
    • Prophecy
    • Mocking Traits and Abstract Classes
    • Stubbing and Mocking Web Services
  • 9. Code Coverage Analysis
    • Software Metrics for Code Coverage
    • Whitelisting Files
    • Ignoring Code Blocks
    • Specifying Covered Code Parts
    • Edge Cases
    • Speeding Up Code Coverage with Xdebug
  • 10. Logging
    • Test Results (XML)
    • Code Coverage (XML)
    • Code Coverage (TEXT)
  • 11. Extending PHPUnit
    • Subclass PHPUnit\Framework\TestCase
    • Write custom assertions
    • Extending the TestRunner
      • Configuring extensions

Appendix

  • 1. Assertions
    • Static vs. Non-Static Usage of Assertion Methods
    • assertArrayHasKey()
    • assertClassHasAttribute()
    • assertArraySubset()
    • assertClassHasStaticAttribute()
    • assertContains()
    • assertStringContainsString()
    • assertStringContainsStringIgnoringCase()
    • assertContainsOnly()
    • assertContainsOnlyInstancesOf()
    • assertCount()
    • assertDirectoryExists()
    • assertDirectoryIsReadable()
    • assertDirectoryIsWritable()
    • assertEmpty()
    • assertEqualXMLStructure()
    • assertEquals()
    • assertEqualsCanonicalizing()
    • assertEqualsIgnoringCase()
    • assertEqualsWithDelta()
    • assertFalse()
    • assertFileEquals()
    • assertFileExists()
    • assertFileIsReadable()
    • assertFileIsWritable()
    • assertGreaterThan()
    • assertGreaterThanOrEqual()
    • assertInfinite()
    • assertInstanceOf()
    • assertIsArray()
    • assertIsBool()
    • assertIsCallable()
    • assertIsFloat()
    • assertIsInt()
    • assertIsIterable()
    • assertIsNumeric()
    • assertIsObject()
    • assertIsResource()
    • assertIsScalar()
    • assertIsString()
    • assertIsReadable()
    • assertIsWritable()
    • assertJsonFileEqualsJsonFile()
    • assertJsonStringEqualsJsonFile()
    • assertJsonStringEqualsJsonString()
    • assertLessThan()
    • assertLessThanOrEqual()
    • assertNan()
    • assertNull()
    • assertObjectHasAttribute()
    • assertRegExp()
    • assertStringMatchesFormat()
    • assertStringMatchesFormatFile()
    • assertSame()
    • assertStringEndsWith()
    • assertStringEqualsFile()
    • assertStringStartsWith()
    • assertThat()
    • assertTrue()
    • assertXmlFileEqualsXmlFile()
    • assertXmlStringEqualsXmlFile()
    • assertXmlStringEqualsXmlString()
  • 2. Annotations
    • @author
    • @after
    • @afterClass
    • @backupGlobals
    • @backupStaticAttributes
    • @before
    • @beforeClass
    • @codeCoverageIgnore*
    • @covers
    • @coversDefaultClass
    • @coversNothing
    • @dataProvider
    • @depends
    • @doesNotPerformAssertions
    • @group
    • @large
    • @medium
    • @preserveGlobalState
    • @requires
    • @runTestsInSeparateProcesses
    • @runInSeparateProcess
    • @small
    • @test
    • @testdox
    • @testWith
    • @ticket
    • @uses
  • 3. The XML Configuration File
    • The <phpunit> Element
      • The backupGlobals Attribute
      • The backupStaticAttributes Attribute
      • The bootstrap Attribute
      • The cacheResult Attribute
      • The cacheResultFile Attribute
      • The cacheTokens Attribute
      • The colors Attribute
      • The columns Attribute
      • The convertDeprecationsToExceptions Attribute
      • The convertErrorsToExceptions Attribute
      • The convertNoticesToExceptions Attribute
      • The convertWarningsToExceptions Attribute
      • The disableCodeCoverageIgnore Attribute
      • The forceCoversAnnotation Attribute
      • The printerClass Attribute
      • The printerFile Attribute
      • The processIsolation Attribute
      • The stopOnError Attribute
      • The stopOnFailure Attribute
      • The stopOnIncomplete Attribute
      • The stopOnRisky Attribute
      • The stopOnSkipped Attribute
      • The stopOnWarning Attribute
      • The stopOnDefect Attribute
      • The failOnRisky Attribute
      • The failOnWarning Attribute
      • The beStrictAboutChangesToGlobalState Attribute
      • The beStrictAboutOutputDuringTests Attribute
      • The beStrictAboutResourceUsageDuringSmallTests Attribute
      • The beStrictAboutTestsThatDoNotTestAnything Attribute
      • The beStrictAboutTodoAnnotatedTests Attribute
      • The beStrictAboutCoversAnnotation Attribute
      • The ignoreDeprecatedCodeUnitsFromCodeCoverage Attribute
      • The enforceTimeLimit Attribute
      • The defaultTimeLimit Attribute
      • The timeoutForSmallTests Attribute
      • The timeoutForMediumTests Attribute
      • The timeoutForLargeTests Attribute
      • The testSuiteLoaderClass Attribute
      • The testSuiteLoaderFile Attribute
      • The defaultTestSuite Attribute
      • The verbose Attribute
      • The stderr Attribute
      • The reverseDefectList Attribute
      • The registerMockObjectsFromTestArgumentsRecursively Attribute
      • The extensionsDirectory Attribute
      • The executionOrder Attribute
      • The resolveDependencies Attribute
      • The testdox Attribute
      • The noInteraction Attribute
    • The <testsuites> Element
      • The <testsuite> Element
    • The <groups> Element
    • The <testdoxGroups> Element
    • The <filter> Element
    • The <listeners> Element
      • The <listener> Element
    • The <extensions> Element
      • The <extension> Element
        • The <arguments> Element
    • The <logging> Element
      • The <log> Element
    • The <php> Element
      • The <includePath> Element
      • The <ini> Element
      • The <const> Element
      • The <var> Element
      • The <env> Element
      • The <get> Element
      • The <post> Element
      • The <cookie> Element
      • The <server> Element
      • The <files> Element
      • The <request> Element
  • 4. Bibliography
  • 5. Copyright
PHPUnit
  • Docs »
  • Search
  • Edit on GitHub


© Copyright 2019, Sebastian Bergmann. Revision d2b3e700.

Read the Docs v: latest
Versions
8.5
8.4
8.3
8.2
8.1
8.0
7.5
7.4
7.3
7.2
7.1
7.0
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.