Scriptindex.de

[ Menü ]

Home
News
Scripts
Neuzugänge
Suchen
Bücher
Manuals

[ Inhalt ]

Script eintragen
Tutorial eintragen
Newsletter
Umfragen
Link zu uns
Werbung bei uns
Kontakt
Impressum

[ Statistik ]

Hits gesamt: 5203233
Hits Heute: 1336
max. Hits (10.07.07): 6964
User Online: 30
Scripts: 2828

[ Partner ]

CodeBase
I.S.U.M.
LUG Bayreuth
PEAR NEWS
PHP Classes

[ Facebook ]

[ Eigene Domain? ]

[ Buchtipp ]

CSS. Kurz und gut.
CSS. Kurz und gut.

Manuals > PEAR > PHPUnit::TestCase

PHPUnit::TestCase

PHPUnit::TestCase --  A TestCase defines the fixture to run multiple tests.

To define a TestCase

  • 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 among test runs.

PHPUnit::TestCase

<?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; } } ?>

For each test implement a method which interacts with the fixture. Verify the expected results with assertions specified by calling assert with a boolean.

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


Copyright 1998 - 2009 by I.S.U.M.