You are here

public function PHPUnit_Extensions_PhptTestSuite::__construct in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/src/Extensions/PhptTestSuite.php \PHPUnit_Extensions_PhptTestSuite::__construct()

Constructs a new TestSuite for .phpt test cases.

Parameters

string $directory:

Throws

PHPUnit_Framework_Exception

Overrides PHPUnit_Framework_TestSuite::__construct

File

vendor/phpunit/phpunit/src/Extensions/PhptTestSuite.php, line 24

Class

PHPUnit_Extensions_PhptTestSuite
Suite for .phpt test cases.

Code

public function __construct($directory) {
  if (is_string($directory) && is_dir($directory)) {
    $this
      ->setName($directory);
    $facade = new File_Iterator_Facade();
    $files = $facade
      ->getFilesAsArray($directory, '.phpt');
    foreach ($files as $file) {
      $this
        ->addTestFile($file);
    }
  }
  else {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'directory name');
  }
}