[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tests/classes/ -> eztestunit.php (source)

   1  <?php
   2  //
   3  // Definition of eZTestUnit class
   4  //
   5  // Created on: <30-Jan-2004 08:57:09 >
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file eztestunit.php
  30  */
  31  
  32  /*!
  33    \class eZTestUnit eztestunit.php
  34    \ingroup eZTest
  35    \brief eZTestUnit defines the basis for a unit test
  36  
  37    This class provides basic functionality and interface
  38    for creating test units. It keeps a list of tests and
  39    a name which are accessible with testList() and name().
  40  
  41    To add new tests use addTestEntry() with the appropriate
  42    test data. What data to add to the entry is decided
  43    by the test runner, see eZTestRunner for more information.
  44  
  45    The methods setup() and teardown() will be called before
  46    and after the test itself is run. This allows for common
  47    initialization and cleanup code.
  48  
  49    For more convenient test handling use the eZTestCase class,
  50    it has ready made functionality for placing test code
  51    in methods.
  52  
  53  */
  54  
  55  class eZTestUnit
  56  {
  57      /*!
  58       Initializes the unit with the name \a $name, if the name is \c false then the class name is used.
  59      */
  60      function eZTestUnit( $name = false )
  61      {
  62          if ( !$name )
  63              $name = get_class( $this );
  64          $this->Name = $name;
  65          $this->TestList = array();
  66      }
  67  
  68      /*!
  69       \virtual
  70       This function is called before the test method is called.
  71       It can be overriden to have common initialization code for all tests.
  72      */
  73      function setup()
  74      {
  75      }
  76  
  77      /*!
  78       \virtual
  79       This function is called after the test method has finished its call.
  80       It can be overriden to remove any initialization done in setup().
  81      */
  82      function teardown()
  83      {
  84      }
  85  
  86      /*!
  87       \return the number of tests in the unit.
  88      */
  89      function count()
  90      {
  91          return count( $this->TestList );
  92      }
  93  
  94      /*!
  95       \return an array with tests.
  96      */
  97      function testList()
  98      {
  99          return $this->TestList;
 100      }
 101  
 102      /*!
 103       \return the name of the test unit.
 104      */
 105      function name()
 106      {
 107          return $this->Name;
 108      }
 109  
 110      /*!
 111       \protected
 112       Adds a new test entry for the test list.
 113      */
 114      function addTestEntry( $entry )
 115      {
 116          $this->TestList[] = $entry;
 117      }
 118  
 119      /// \privatesection
 120      /// Name of test case
 121      var $Name;
 122      /// A list of tests to run
 123      var $TestList;
 124  }
 125  
 126  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7