📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PHPUnit Testing What is PHPUnit?

What is PHPUnit?

4 min read Quiz at the end
Introduction to PHPUnit: the standard PHP testing framework for unit, integration, and TDD.

What is PHPUnit?

PHPUnit is the standard testing framework for PHP. It enables Test-Driven Development (TDD), unit testing, integration testing, and mock-based testing.

  • Automatic test discovery
  • Rich assertion library
  • Mock objects and stubs
  • Code coverage reports
  • Data providers for parametric tests
composer require --dev phpunit/phpunit
./vendor/bin/phpunit --version
./vendor/bin/phpunit tests/
Topic Quiz · 4 questions

Test your understanding before moving on

1. Which command installs PHPUnit?
💡 PHPUnit is installed via Composer: composer require --dev phpunit/phpunit.
2. Test methods must start with what?
💡 PHPUnit discovers test methods by finding public methods starting with test.
3. What class do PHPUnit test classes extend?
💡 All PHPUnit test classes must extend PHPUnitFrameworkTestCase.
4. What does TDD stand for?
💡 TDD is Test-Driven Development — write tests first then code to pass them.