PHPUnit::TestCase

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

To define a TestCase

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

    Поддержать сайт на родительском проекте КГБ