[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

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

   1  <?php
   2  //
   3  // Definition of eZTestSuite class
   4  //
   5  // Created on: <30-Jan-2004 11:09:08 >
   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 eztestsuite.php
  30  */
  31  
  32  /*!
  33    \class eZTestSuite eztestsuite.php
  34    \ingroup eZTest
  35    \brief eZTestSuite allows multiple test units to be run as one test
  36  
  37    This class makes it easier to run multiple test cases or units
  38    without resorting to multiple calls to run() on an eZTestRunner.
  39    The suite will accumulate all tests into one test list.
  40  
  41    Using this class is simply to create an instance with a name and
  42    then add test units with addUnit(). The suite itself is also a
  43    test unit so it is possible to add one suite to another as a
  44    unit.
  45  
  46    \code
  47  $suite = new eZTestSuite( 'Test of my system' );
  48  $mainTest = new MyMainTest();
  49  $subsystemTest = new MySubsystemTest();
  50  
  51  $suite->addUnit( $mainTest );
  52  $suite->addUnit( $subsystemTest );
  53  
  54  $runner = new eZTestCLIRunner();
  55  $runner->run( $suite );
  56    \endcode
  57  
  58  */
  59  
  60  include_once ( 'tests/classes/eztestunit.php' );
  61  
  62  class eZTestSuite extends eZTestUnit
  63  {
  64      /*!
  65       Initializes the test suite with the name \a $name.
  66      */
  67      function eZTestSuite( $name = false )
  68      {
  69          $this->eZTestUnit( $name );
  70      }
  71  
  72      /*!
  73       Adds all tests from the test unit \a $unit to this test suite.
  74       \note If \a $unit is not a subclass of eZTestUnit a warning is issued and the tests are not added.
  75      */
  76      function addUnit( &$unit )
  77      {
  78          if ( is_subclass_of( $unit, 'eztestunit' ) )
  79          {
  80              $testList = $unit->testList();
  81              foreach ( $testList as $entry )
  82              {
  83                  $entry['name'] = $unit->name() . '::' . $entry['name'];
  84                  $this->addTestEntry( $entry );
  85              }
  86          }
  87          else
  88          {
  89              eZDebug::writeWarning( "Tried to add test unit for an object which is not subclassed from eZTestUnit",
  90                                     'eZTestSuite::addUnit' );
  91          }
  92      }
  93  }
  94  
  95  ?>


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