GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
sqlmarker
Browse code
Assigned result of run() to a different variable from the TestResult that’s passed in as an argument.
master
1 parent
0be468b
commit
a3602fd3f0c696189c32167eac46097401842605
Nigel Stanger
authored
on 26 Jun 2013
Patch
Showing
1 changed file
Unit_testing/test.php
Ignore Space
Show notes
View
Unit_testing/test.php
<?php require_once "PHPUnit/Autoload.php"; require_once "BDL_Test_Staff_structure.php"; class SimpleTestListener implements PHPUnit_Framework_TestListener { private $totalMark = 0; public function getTotalMark() { return $this->totalMark; } public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) { printf("Error while running test '%s'.\n", $test->getName()); } public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) { printf("Test '%s' failed.\n", $test->getName()); } public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) { printf("Test '%s' is incomplete.\n", $test->getName()); } public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) { printf("Test '%s' has been skipped.\n", $test->getName()); } public function startTest(PHPUnit_Framework_Test $test) { printf("Test '%s' started.\n", $test->getName()); } public function endTest(PHPUnit_Framework_Test $test, $time) { printf("Test '%s' ended.\n", $test->getName()); } public function startTestSuite(PHPUnit_Framework_TestSuite $suite) { printf("TestSuite '%s' started.\n", $suite->getName()); } public function endTestSuite(PHPUnit_Framework_TestSuite $suite) { printf("TestSuite '%s' ended.\n", $suite->getName()); } } $suite = new PHPUnit_Framework_TestSuite('BDL_Test_Staff_structure'); $result = new PHPUnit_Framework_TestResult; $listener = new SimpleTestListener; $result->addListener($listener); $testresult = $suite->run( $result, '/testTableExists/' ); if ( count( $testresult->passed() ) == 1 ) echo "Table exists.\n"; $testresult = $suite->run( $result, '/testColumnExists/' ); if ( count( $testresult->passed() ) == 9 ) echo "Table has all the expected columns.\n"; ?>
<?php require_once "PHPUnit/Autoload.php"; require_once "BDL_Test_Staff_structure.php"; class SimpleTestListener implements PHPUnit_Framework_TestListener { private $totalMark = 0; public function getTotalMark() { return $this->totalMark; } public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) { printf("Error while running test '%s'.\n", $test->getName()); } public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) { printf("Test '%s' failed.\n", $test->getName()); } public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) { printf("Test '%s' is incomplete.\n", $test->getName()); } public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) { printf("Test '%s' has been skipped.\n", $test->getName()); } public function startTest(PHPUnit_Framework_Test $test) { printf("Test '%s' started.\n", $test->getName()); } public function endTest(PHPUnit_Framework_Test $test, $time) { printf("Test '%s' ended.\n", $test->getName()); } public function startTestSuite(PHPUnit_Framework_TestSuite $suite) { printf("TestSuite '%s' started.\n", $suite->getName()); } public function endTestSuite(PHPUnit_Framework_TestSuite $suite) { printf("TestSuite '%s' ended.\n", $suite->getName()); } } $suite = new PHPUnit_Framework_TestSuite('BDL_Test_Staff_structure'); $result = new PHPUnit_Framework_TestResult; $listener = new SimpleTestListener; $result->addListener($listener); $suite->run( $result, '/test(Table|Column)Exists/' ); if ( count( $result->passed() ) == 10 ) echo "Table exists with all the expected columns.\n"; ?>
Show line notes below