Browse Source

modified AutoloadBuilder for test exclusion

master
Anton Grebnev 13 years ago
parent
commit
6aab56c814
  1. 11
      util/AutoloadBuilder.php

11
util/AutoloadBuilder.php

@ -17,8 +17,11 @@
class AutoloadBuilder
{
protected $autoload;
protected $dirs;
protected $handler;
protected $regex = '/(class|interface) ([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/';
public function __construct($autoload, $dirs = array())
@ -41,7 +44,7 @@ class AutoloadBuilder
foreach ($iterator as $file) {
// skip non php files
$e = explode('.', $file->getFileName());
if ((end($e) !== 'php') || strstr($file->getFileName(), 'test')) {
if ((end($e) !== 'php') || $this->rightSubstr($file->getFileName(), 8) == 'Test.php') {
continue;
}
@ -86,4 +89,10 @@ class AutoloadBuilder
}
return (bool) fwrite($this->handler, $string);
}
protected function rightSubstr($string, $nchars)
{
$right = substr($string, strlen($string) - $nchars, $nchars);
return $right;
}
}
Loading…
Cancel
Save