1<?php 2/* 3 * This file is part of PHPUnit. 4 * 5 * (c) Sebastian Bergmann <sebastian@phpunit.de> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11/** 12 * Suite for .phpt test cases. 13 */ 14class PHPUnit_Extensions_PhptTestSuite extends PHPUnit_Framework_TestSuite 15{ 16 /** 17 * Constructs a new TestSuite for .phpt test cases. 18 * 19 * @param string $directory 20 * 21 * @throws PHPUnit_Framework_Exception 22 */ 23 public function __construct($directory) 24 { 25 if (is_string($directory) && is_dir($directory)) { 26 $this->setName($directory); 27 28 $facade = new File_Iterator_Facade; 29 $files = $facade->getFilesAsArray($directory, '.phpt'); 30 31 foreach ($files as $file) { 32 $this->addTestFile($file); 33 } 34 } else { 35 throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'directory name'); 36 } 37 } 38} 39