Getting started with writing PHPUnit tests requires grasping a few basic concepts, such as the following:
- The setUp() method: Analogous to the constructor, this is where we create the objects against which we will perform the test.
- The tearDown() method: Analogous to the destructor, this is where we clean up objects against which we performed the test.
- The test*() methods: Every public method whose name begins with test, for example, testSomething(), testItAgain(), and so on, is considered a single test. The same effect can be achieved by adding the @test annotation in a method's docblock; although, this seems to be a less used case.
- The @depends annotation: This allows expressing dependencies between the test methods.
- Assertions ...