Test Class - AugustusKling/RudimentaryPhpTest GitHub Wiki
Writing Tests
A test class is any implementable class (non-abstract class) that inherits from RudimentaryPhpTest_BaseTest. The available test classes will be scanned for methods that are matching a pattern to distinguish test methods from helper methods. A simple test might look like:
class SampleTest extends RudimentaryPhpTest_BaseTest {
public function dummyTest(){
// TODO: Use your classes under test here
$this->assertEquals($expectedValue, $actualValue, 'Plain language explanation of semantics.');
}
}
The example contains one test called dummyTest that has one [assertion](Assertion Provider). You would replace the TODO comment with usage of your classes under test. Following your test code there is one or more assertions that ensure desired conditions are met. Although the explanation of the semantics is optional, its presence might help you a lot when debugging.
Test classes can have any number of tests and their name does not matter. The pattern for distinguishing tests from other methods can be set as an option. See RudimentaryPhpTest_BaseTest for more information.
It is recommended to create an intermediate class that inherits from RudimentaryPhpTest_BaseTest and make your test inherit from the intermediate class. Doing so allows you to provide assertions, set up code and switch the testing framework more easily should you desire this in future.