Requirements
- Knowledge of Programming
- Basic PHP Knowledge
Overview
In this course, Unit Testing with PHPUnit, you’ll learn to write unit tests in PHP. First, you’ll explore the fundamentals of unit tests and PHPUnit itself. Next, you’ll discover how to write better tests using mocks. Finally, you’ll learn how to track your code coverage and run tests using continuous integration. When you’re finished with this course, you’ll have the skills and knowledge of PHPUnit needed to increase the quality of your PHP applications.
What Will You Study
Local work environment setup
Composer
IDE Configuration
Fundamentals
Introduction to assertions
Using multiple Assertions
Correcting Bugs through Testing
Naming Conventions and Standards
PHPUnit XML configuration
Apply coloring console test output and testdox automatically
Organize test suite using XML configuration file
Create PHP constants in XML configuration file
Test dependencies, Fixtures, and Exceptions
Dependencies between tests
SetUp and TearDown
Text Fixture
Exceptions Test
Mocks and Stubs
Test doubles: create mock objects to remove dependencies on external resources
Dependency injection: inject objects that a class depends on
Test object interactions: verify how a dependency is used
Customize the creation of the mock object: the getMockBuilder method
TDD - Test-Driven development
Writing test before code
Targeted development test
Code refactor with tests
Advanced test
Protected / private methods
Attributes & nbsp; protected / private
Static methods