[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

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

   1  <?php
   2  //
   3  // Definition of eZTestCLIRunner class
   4  //
   5  // Created on: <30-Jan-2004 10:46:10 >
   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 eztestclirunner.php
  30  */
  31  
  32  /*!
  33    \class eZTestCLIRunner eztestclirunner.php
  34    \ingroup eZTest
  35    \brief eZTestRunner runs tests from test units and displays results on the console
  36  
  37    This class overrides the display() method to provide instant
  38    reporting of test results. Using this class is the same
  39    as with the eZTestRunner class.
  40  
  41    If you want to display all test results call the printResults() after
  42    the tests have been run.
  43  
  44  */
  45  
  46  include_once ( 'tests/classes/eztestrunner.php' );
  47  
  48  class eZTestCLIRunner extends eZTestRunner
  49  {
  50      /*!
  51       Inititalizes the test runner.
  52      */
  53      function eZTestCLIRunner()
  54      {
  55          $this->eZTestRunner();
  56      }
  57  
  58      /*!
  59       Prints all results to the console.
  60      */
  61      function printResults()
  62      {
  63          $results = $this->resultList();
  64          foreach ( $results as $result )
  65          {
  66              $this->display( $result );
  67          }
  68      }
  69  
  70      /*!
  71       Displays the result text on the console.
  72      */
  73      function display( $result )
  74      {
  75          include_once ( 'lib/ezutils/classes/ezcli.php' );
  76          $cli =& eZCLI::instance();
  77          $col = 70;
  78          $cli->output( $result['name'] . $cli->gotoColumn( $col ), false );
  79          if ( $result['status'] )
  80          {
  81              $cli->output( $cli->stylize( 'success', "[Success]" ) );
  82          }
  83          else
  84          {
  85              $cli->output( $cli->stylize( 'error', "[Failure]" ) );
  86              foreach ( $result['messages'] as $message )
  87              {
  88                  $cli->output( "  * ", false );
  89                  if ( $message['assert'] )
  90                  {
  91                      $cli->output( '#' . $message['assert_number'] . ' ', false );
  92                      $cli->output( '' . $message['assert'] . ': ', false );
  93                  }
  94                  $cli->output( $message['text'], false );
  95                  $cli->output();
  96              }
  97          }
  98      }
  99  }
 100  
 101  ?>


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