Apache Zeta Components Manual :: File Source for regression_suite.php

Source for file regression_suite.php

Documentation is available at regression_suite.php

  1. <?php
  2. /**
  3.  *
  4.  * Licensed to the Apache Software Foundation (ASF) under one
  5.  * or more contributor license agreements.  See the NOTICE file
  6.  * distributed with this work for additional information
  7.  * regarding copyright ownership.  The ASF licenses this file
  8.  * to you under the Apache License, Version 2.0 (the
  9.  * "License"); you may not use this file except in compliance
  10.  * with the License.  You may obtain a copy of the License at
  11.  * 
  12.  *   http://www.apache.org/licenses/LICENSE-2.0
  13.  * 
  14.  * Unless required by applicable law or agreed to in writing,
  15.  * software distributed under the License is distributed on an
  16.  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17.  * KIND, either express or implied.  See the License for the
  18.  * specific language governing permissions and limitations
  19.  * under the License.
  20.  *
  21.  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  22.  * @version //autogentag//
  23.  * @filesource
  24.  * @package UnitTest
  25.  */
  26.  
  27. /**
  28.  * @package UnitTest
  29.  */
  30. class ezcTestRegressionSuite extends PHPUnit_Framework_TestSuite
  31. {
  32.     public function __construct$theClass ''$name '' )
  33.     {
  34.         $argumentsValid false;
  35.  
  36.         if is_object$theClass &&
  37.              $theClass instanceof ReflectionClass )
  38.         {
  39.              $argumentsValid true;
  40.         }
  41.         else if is_string$theClass )
  42.                   && $theClass !== ''
  43.                   && class_exists$theClassfalse ) )
  44.         {
  45.             $argumentsValid true;
  46.  
  47.             if $name == '' )
  48.             {
  49.                 $name $theClass;
  50.             }
  51.  
  52.             $theClass new ReflectionClass$theClass );
  53.         }
  54.         else if is_string$theClass ) )
  55.         {
  56.             $this->setName$theClass );
  57.             return;
  58.         }
  59.  
  60.         if !$argumentsValid )
  61.         {
  62.             throw new InvalidArgumentException();
  63.         }
  64.  
  65.         if $name != '' )
  66.         {
  67.             $this->setName$name );
  68.         }
  69.         else
  70.         {
  71.             $this->setName$theClass->getName() );
  72.         }
  73.  
  74.         $constructor $theClass->getConstructor();
  75.  
  76.         if $constructor !== null &&
  77.              !$constructor->isPublic() )
  78.         {
  79.             $this->addTest(
  80.                 new PHPUnit_Framework_Warning(
  81.                     sprintf(
  82.                         'Class "%s" has no public constructor.',
  83.                         $theClass->getName()
  84.                         )
  85.                     )
  86.                 );
  87.  
  88.             return;
  89.         }
  90.  
  91.         $names array();
  92. /*
  93.         if ( $theClass->getName() !== 'ezcTestRegressionTest'
  94.              && !$theClass->isSubclassOf( 'ezcTestRegressionTest' ) )
  95.         {
  96.             $this->addTest(
  97.                 new PHPUnit_Framework_Warning(
  98.                     sprintf(
  99.                         'Class "%s" is not a subclass of ezcTestRegressionTest.',
  100.                         $theClass->getName()
  101.                         )
  102.                     )
  103.                 );
  104.         }
  105. */
  106.         $mainTest $theClass->newInstance();
  107.         $files $mainTest->getFiles();
  108.  
  109.         foreach $files as $fileEntry )
  110.         {
  111.             $this->addRegressionTestFile$fileEntry['file']$mainTest );
  112.         }
  113.  
  114.         $tests $this->tests();
  115.         if empty$tests ) )
  116.         {
  117.             $this->addTest(
  118.                 new PHPUnit_Framework_Warning(
  119.                     sprintf(
  120.                         'No regression tests found in class "%s".',
  121.                         $theClass->getName()
  122.                         )
  123.                     )
  124.                 );
  125.         }
  126.     }
  127.  
  128.     public function addRegressionTestFile$file$mainTest )
  129.     {
  130.         $test clone $mainTest;
  131.         $test->setCurrentFile$file );
  132.         $this->addTest$test );
  133.     }
  134. }
  135. ?>
Documentation generated by phpDocumentor 1.4.3