Testing PHP: Difference between revisions

From Rixort Wiki
Jump to navigation Jump to search
Created page with "Category:PHP"
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
== PHPUnit ==
* Any function with the prefix 'test' is considered a test (e.g. testSubtraction)
* A test function can contain multiple assertions
* setUp function is run before each test function
* tearDown function is run after each test function
* setUpBeforeClass function is run before each class of tests (e.g. establishing a database connection)
* tearDownAfterClass function is run after each class of tests
== Psalm ==
== PHPStan ==
== PHPCS ==
== PHPCBF ==
== PHPLint ==
== Codeception ==
* Can have different 'suites' of tests
== Test Driven Development ==
== Behaviour Driver Development ==
[[Category:PHP]]
[[Category:PHP]]

Latest revision as of 10:40, 18 December 2023

PHPUnit

  • Any function with the prefix 'test' is considered a test (e.g. testSubtraction)
  • A test function can contain multiple assertions
  • setUp function is run before each test function
  • tearDown function is run after each test function
  • setUpBeforeClass function is run before each class of tests (e.g. establishing a database connection)
  • tearDownAfterClass function is run after each class of tests

Psalm

PHPStan

PHPCS

PHPCBF

PHPLint

Codeception

  • Can have different 'suites' of tests

Test Driven Development

Behaviour Driver Development