Source for file TestCase.php
Documentation is available at TestCase.php
// +------------------------------------------------------------------------+
// +------------------------------------------------------------------------+
// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
// +------------------------------------------------------------------------+
// | This source file is subject to version 3.00 of the PHP License, |
// | that is available at http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +------------------------------------------------------------------------+
// $Id: TestCase.php,v 1.16 2004/12/22 08:06:11 sebastian Exp $
require_once 'PHPUnit/Assert.php';
require_once 'PHPUnit/TestResult.php';
* A TestCase defines the fixture to run multiple tests.
* 1) Implement a subclass of PHPUnit_TestCase.
* 2) Define instance variables that store the state of the fixture.
* 3) Initialize the fixture state by overriding setUp().
* 4) Clean-up after a test by overriding tearDown().
* Each test runs in its own fixture so there can be no side effects
* class MathTest extends PHPUnit_TestCase {
* function MathTest($name) {
* $this->PHPUnit_TestCase($name);
* For each test implement a method which interacts with the fixture.
* Verify the expected results with assertions specified by calling
* $this->assertTrue($this->fValue1 + $this->fValue2 == 5);
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
* @copyright Copyright © 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
* @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
* The name of the test case.
* PHPUnit_TestResult object
* Constructs a test case with the given name.
* Counts the number of test cases executed by run(TestResult result).
* Gets the name of a TestCase.
* Runs the test case and collects the results in a given TestResult object.
$this->_result = &$result;
$this->_result->run ($this);
* Runs the bare test sequence.
* Override to run the test and assert its state.
* Sets the name of a TestCase.
* Returns a string representation of the test case.
* Creates a default TestResult object.
* Fails a test with the given message.
function fail($message = '') {
$this->_result->addFailure ($this, $message);
$this->_result->addPassedTest ($this);
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
function setUp() { /* abstract */ }
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
Documentation generated on Mon, 11 Mar 2019 14:22:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|