Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

TestFilterIterator -> FilterIterator

  • Loading branch information...
commit d25b96775094d19b931ea6dff88c834496527397 1 parent ad9bc7e
@sebastianbergmann authored
View
4 PHPUnit/Runner/IncludePathTestCollector.php
@@ -46,7 +46,7 @@
require_once 'PHPUnit/Util/Filter.php';
require_once 'PHPUnit/Runner/TestCollector.php';
-require_once 'PHPUnit/Runner/TestFilterIterator.php';
+require_once 'PHPUnit/Util/FilterIterator.php';
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
@@ -91,7 +91,7 @@ public function collectTests()
);
}
- $filterIterator = new PHPUnit_Runner_TestFilterIterator(
+ $filterIterator = new PHPUnit_Util_FilterIterator(
$includePathsIterator
);
View
25 PHPUnit/Runner/TestFilterIterator.php → PHPUnit/Util/FilterIterator.php
@@ -61,19 +61,32 @@
* @since Class available since Release 3.0.0
*/
-class PHPUnit_Runner_TestFilterIterator extends FilterIterator
+class PHPUnit_Util_FilterIterator extends FilterIterator
{
/**
- * Considers a file to contain a test class when its name ends with
- * "Test.php".
- *
- * @param string $classFileName
+ * @var string
+ * @access private
+ */
+ private $suffix;
+
+ /**
+ * @param Iterator $iterator
+ * @param string $suffix
+ * @access public
+ */
+ public function __construct(Iterator $iterator, $suffix = 'Test.php')
+ {
+ parent::__construct($iterator);
+ $this->suffix = $suffix;
+ }
+
+ /**
* @return boolean
* @access public
*/
public function accept()
{
- return substr($this->getInnerIterator()->current(), -8) == 'Test.php';
+ return substr($this->getInnerIterator()->current(), -1 * strlen($this->suffix)) == $this->suffix;
}
}
?>
View
6 package.xml
@@ -276,9 +276,6 @@
<file baseinstalldir="/" name="TestCollector.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
- <file baseinstalldir="/" name="TestFilterIterator.php" role="php">
- <tasks:replace from="@package_version@" to="version" type="package-info" />
- </file>
<file baseinstalldir="/" name="TestSuiteLoader.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
@@ -606,6 +603,9 @@
<file baseinstalldir="/" name="Filter.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
+ <file baseinstalldir="/" name="FilterIterator.php" role="php">
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
<file baseinstalldir="/" name="Getopt.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
Please sign in to comment.
Something went wrong with that request. Please try again.