Spec-Zone.ru › PHPUnit 9

PHPUnit

PHPUnit Manual

Edition for PHPUnit 9.5. Updated on Dec 09, 2020.

Sebastian Bergmann

This work is licensed under the Creative Commons Attribution 3.0 Unported License.

Contents:

  • 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
    • Mocking Traits and Abstract Classes
    • Stubbing and Mocking Web Services
  • 9. Code Coverage Analysis
    • Software Metrics for Code Coverage
    • Including Files
    • Ignoring Code Blocks
    • Specifying Covered Code Parts
    • Edge Cases
  • 10. 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()
    • assertClassHasStaticAttribute()
    • assertContains()
    • assertStringContainsString()
    • assertStringContainsStringIgnoringCase()
    • assertContainsOnly()
    • assertContainsOnlyInstancesOf()
    • assertCount()
    • assertDirectoryExists()
    • assertDirectoryIsReadable()
    • assertDirectoryIsWritable()
    • assertEmpty()
    • assertEquals()
    • assertEqualsCanonicalizing()
    • assertEqualsIgnoringCase()
    • assertEqualsWithDelta()
    • assertObjectEquals()
    • 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()
    • assertMatchesRegularExpression()
    • 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 <testsuites> Element
    • The <coverage> Element
    • The <logging> Element
    • The <groups> Element
    • The <testdoxGroups> Element
    • The <listeners> Element
    • The <extensions> Element
    • The <php> Element
  • 4. Bibliography
  • 5. Copyright

© 2005–2020 Sebastian Bergmann
Licensed under the Creative Commons Attribution 3.0 Unported License.
https://phpunit.readthedocs.io/en/9.5/index.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API