[ PHPXref.com ] [ Generated: Sun Jul 20 19:19:39 2008 ] [ PEAR 1.4.5 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> PHPUnit.php (summary)

PHP Version 4 Copyright (c) 2002-2005, Sebastian Bergmann <sb@sebastian-bergmann.de>. All rights reserved.

Author: Sebastian Bergmann
Copyright: 2002-2005 Sebastian Bergmann
License: http://www.opensource.org/licenses/bsd-license.php BSD License
Version: CVS: $Id: PHPUnit.php,v 1.17 2005/11/10 09:47:11 sebastian Exp $
File Size: 132 lines (4 kb)
Included or required: 43 times
Referenced: 0 times
Includes or requires: 3 files
 PHPUnit/TestResult.php
 PHPUnit/TestSuite.php
 PHPUnit/TestCase.php

Defines 1 class

PHPUnit:: (1 method):
  run()


Class: PHPUnit  - X-Ref

PHPUnit runs a TestSuite and returns a TestResult object.

Here is an example:

<code>
<?php
require_once 'PHPUnit.php';

class MathTest extends PHPUnit_TestCase {
var $fValue1;
var $fValue2;

function MathTest($name) {
$this->PHPUnit_TestCase($name);
}

function setUp() {
$this->fValue1 = 2;
$this->fValue2 = 3;
}

function testAdd() {
$this->assertTrue($this->fValue1 + $this->fValue2 == 5);
}
}

$suite = new PHPUnit_TestSuite();
$suite->addTest(new MathTest('testAdd'));

$result = PHPUnit::run($suite);
print $result->toHTML();
?>
</code>

Alternatively, you can pass a class name to the PHPUnit_TestSuite()
constructor and let it automatically add all methods of that class
that start with 'test' to the suite:

<code>
<?php
$suite  = new PHPUnit_TestSuite('MathTest');
$result = PHPUnit::run($suite);
print $result->toHTML();
?>
</code>

run(&$suite)   X-Ref
Runs a test(suite).

param: mixed
return: PHPUnit_TestResult



[ Powered by PHPXref - Served by Debian GNU/Linux ]