PHPUnit_Util_TestDox_NamePrettifier::prettifyTestClass PHP Method

prettifyTestClass() public method

Prettifies the name of a test class.
public prettifyTestClass ( string $name ) : string
$name string
return string
    public function prettifyTestClass($name)
    {
        $title = $name;
        if ($this->suffix !== NULL && $this->suffix == substr($name, -1 * strlen($this->suffix))) {
            $title = substr($title, 0, strripos($title, $this->suffix));
        }
        if ($this->prefix !== NULL && $this->prefix == substr($name, 0, strlen($this->prefix))) {
            $title = substr($title, strlen($this->prefix));
        }
        return $title;
    }

Usage Example

コード例 #1
0
ファイル: ResultPrinter.php プロジェクト: luchaninov/phpunit
 /**
  * A test started.
  *
  * @param PHPUnit_Framework_Test $test
  */
 public function startTest(PHPUnit_Framework_Test $test)
 {
     if (!$this->isOfInterest($test)) {
         return;
     }
     $class = get_class($test);
     if ($this->testClass != $class) {
         if ($this->testClass != '') {
             $this->doEndClass();
         }
         $classAnnotations = PHPUnit_Util_Test::parseTestMethodAnnotations($class);
         if (isset($classAnnotations['class']['testdox'][0])) {
             $this->currentTestClassPrettified = $classAnnotations['class']['testdox'][0];
         } else {
             $this->currentTestClassPrettified = $this->prettifier->prettifyTestClass($class);
         }
         $this->startClass($class);
         $this->testClass = $class;
         $this->tests = [];
     }
     $annotations = $test->getAnnotations();
     if (isset($annotations['method']['testdox'][0])) {
         $this->currentTestMethodPrettified = $annotations['method']['testdox'][0];
     } else {
         $this->currentTestMethodPrettified = $this->prettifier->prettifyTestMethod($test->getName(false));
     }
     $this->testStatus = PHPUnit_Runner_BaseTestRunner::STATUS_PASSED;
 }
All Usage Examples Of PHPUnit_Util_TestDox_NamePrettifier::prettifyTestClass