PHPUnit
[ class tree: PHPUnit ] [ index: PHPUnit ] [ all elements ]

Class: PHPUnit

Source Location: /PHPUnit-1.2.2/PHPUnit.php

Class Overview


PHPUnit runs a TestSuite and returns a TestResult object.


Author(s):

Copyright:

  • Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 75]
PHPUnit runs a TestSuite and returns a TestResult object.

Here is an example:

  1.  <?php
  2.  require_once 'PHPUnit.php';
  3.  
  4.  class MathTest extends PHPUnit_TestCase {
  5.      var $fValue1;
  6.      var $fValue2;
  7.  
  8.      function MathTest($name{
  9.        $this->PHPUnit_TestCase($name);
  10.      }
  11.  
  12.      function setUp({
  13.        $this->fValue1 = 2;
  14.        $this->fValue2 = 3;
  15.      }
  16.  
  17.      function testAdd({
  18.        $this->assertTrue($this->fValue1 $this->fValue2 == 5);
  19.      }
  20.  }
  21.  
  22.  $suite = new PHPUnit_TestSuite();
  23.  $suite->addTest(new MathTest('testAdd'));
  24.  
  25.  $result PHPUnit::run($suite);
  26.  print $result->toHTML();
  27.  ?>

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:

  1.  <?php
  2.  $suite  = new PHPUnit_TestSuite('MathTest');
  3.  $result PHPUnit::run($suite);
  4.  print $result->toHTML();
  5.  ?>



[ Top ]


Method Detail

run   [line 76]

void &run( &$suite)


Parameters:

   &$suite   — 

[ Top ]


Documentation generated on Thu, 10 Dec 2015 05:37:22 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.