cvs: peardoc /peardoc2/en/package/php/phpunit/testcase intro.xml

From: Date: Sat, 30 Nov 2002 18:08:52 +0000
Subject: cvs: peardoc /peardoc2/en/package/php/phpunit/testcase intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-87@lists.php.net to get a copy of this message
arnaud Sat Nov 30 13:08:52 2002 EDT Added files: /peardoc/peardoc2/en/package/php/phpunit/testcase intro.xml Log: no message Index: peardoc/peardoc2/en/package/php/phpunit/testcase/intro.xml +++ peardoc/peardoc2/en/package/php/phpunit/testcase/intro.xml <refentry id="packages.php.phpunit.testcase.intro"> <refnamediv> <refname>PHPUnit::TestCase</refname> <refpurpose> A TestCase defines the fixture to run multiple tests. </refpurpose> </refnamediv> <refsect1> <title>To define a TestCase</title> <para> <itemizedlist> <listitem> <para>1) Implement a subclass of PHPUnit_TestCase.</para> </listitem> <listitem> <para>2) Define instance variables that store the state of the fixture.</para> </listitem> <listitem> <para>3) Initialize the fixture state by overriding setUp().</para> </listitem> <listitem> <para>4) Clean-up after a test by overriding tearDown().</para> </listitem> </itemizedlist> Each test runs in its own fixture so there can be no side effects among test runs. </para> </refsect1> <refsect1> <title>PHPUnit::TestCase</title> <para> <programlisting role="php"> <![CDATA[ <?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; } } ?> ]]> </programlisting> </para> <para> For each test implement a method which interacts with the fixture. Verify the expected results with assertions specified by calling assert with a boolean. </para> <para> <programlisting role="php"> <![CDATA[ function testPass() { $this->assertTrue($this->fValue1 + $this->fValue2 == 5); } ]]> </programlisting> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->

« previous php.pear.doc (#87) next »