FOUnitTest

FareOffice Unit Test framework. More...


Classes

class  FOUnitTest
 Will be used to gather a group of foUnitTestBase inherited classes. More...
class  FOUnitTestBase
 Abstract base class for all unit test classes. More...
class  standard
 This is the standard Unit Test Skin. More...
class  unitTestSkin
 The abstract base class that are used by all Unit Test Skins. More...


Detailed Description

FareOffice Unit Test framework.

The simplest way to use the FareOffice Unit Test framework, is to keep the current default installation folder path. By that you can execute your unit tests by browsing the file (or your choosen url) http://localhost/fareofficelib/UnitTestHtDocs/index.php

That index file contains this simple code, and doesn't need to do anything else.

 include_once('FareOfficeLib/FareOfficeLib.php');
 $testSuite = &new foUnitTest('./');
 $testSuite->writeTestSuiteGui();

Then you can just start create your own unit test and place them in the folder /var/www/fareofficelib/UnitTestHtDocs/xxx/utExample.php

I'll advice you to add the prefix ut, to both file and class. This to prevent that the class has already been declared.

 // File: utFOUnitTestBase.php
 class utFOUnitTestBase extends foUnitTestBase
 {
    public function doTest()
    {
      $this->_testNeedEmpty();
    }

    private function _testNeedEmpty()
    {
      $this->setSectionLabel('needEmpty');
      $this->addSectionText('Will check FOUnitTestBase::needEmpty().');

      // Will succeed
      eval($this->needEmpty('""'));

      $nullVar = NULL;
      eval($this->needEmpty('$nullVar'));

      $emptyArray = array();
      eval($this->needEmpty('$emptyArray'));
    }
  }*

Author:
Daniel Lindh <daniel@fareoffice.com>
Todo:
Write support for batch execution of the unit tests and then email the result.

Write FOUnitTestBase::needEqualSqlResult

Write FOUnitTestBase::needLess($x, 5)

Write FOUnitTestBase::needMore($x, 5)

Write FOUnitTestBase::needBetween($value, $min, $max)

Write FOUnitTestBase::needKeyExist($arr, array('a', 'b')) The array $arr must have atleast the keys 'a' and 'b'

Write FOUnitTestBase::needValueExist($arr, array('a', 'b')) The array $arr must have the atleast nodes with the values of 'a' and 'b'.

Print statistic about how long time it takes to run a test case.

Functionality that prints the contents of the arguments from needEqual etc. For example when needEqual fails in this case $stringVar = "Game over man"; eval($this->needEqual('$stringVar', '5')); It will print something like Copy: 'Game over man'


Generated on Wed May 6 23:28:24 2009 for fareofficelib by  doxygen 1.5.8