PHP Unit Testing


  • Complete list of assertions. Examples:
  • assertTrue(bool $condition[, string $messageIfFalse = '']);
  • assertEquals(mixed $expected, mixed $actual[, string $messageIfNotEqual = '']);


Unit tests are used for testing source code to see if it contains deals with inputs as we expect. Unit tests are supported by the majority of frameworks. There are several different PHPUnit tests and they might differ in syntax. In this example we are using PHPUnit.