Runs the tests and collects their result in a TestResult.
public run ( PHPUnit_Framework_TestResult $result = null ) : PHPUnit_Framework_TestResult | ||
$result | PHPUnit_Framework_TestResult | |
return | PHPUnit_Framework_TestResult |
class MyTest extends PHPUnit\Framework\TestCase { public function testAddition() { $this->assertEquals(2+2, 4); } public function testSubtraction() { $this->assertEquals(5-2, 3); } } $suite = new PHPUnit_Framework_TestSuite(); $suite->addTestSuite('MyTest'); $result = $suite->run();In this example, we create a new test case called MyTest, with two test methods that check the results of addition and subtraction. We then create a new instance of PHPUnit_Framework_TestSuite, add the MyTest test case to it, and run the suite. The result can then be used to generate a report of the test results. Overall, PHPUnit_Framework_TestSuite is a powerful and flexible library that provides developers with a comprehensive set of tools for unit testing in PHP.
public run ( PHPUnit_Framework_TestResult $result = null ) : PHPUnit_Framework_TestResult | ||
$result | PHPUnit_Framework_TestResult | |
return | PHPUnit_Framework_TestResult |