add @todo note
[phpt.git] / src / PHPT / Section / ExpectationAbstract.php
blob5e9811191c2acfe3782b2882b2f920bd9f5fea06
1 <?php
3 abstract class PHPT_Section_ExpectationAbstract implements PHPT_Section_RunnableAfter
5 protected $_expected = null;
6 private $_exception = 'PHPT_Section_%s_UnexpectedOutputException';
8 public function __construct($data)
10 $this->_expected = $data;
11 $exploded = explode('_', get_class($this));
12 $this->_exception = sprintf($this->_exception, array_pop($exploded));
15 public function run(PHPT_Case $case)
17 if (!$this->_isValid($case)) {
18 $case->leave_file = true;
19 throw new $this->_exception(
20 $case,
21 $this->_expected
25 $path = dirname($case->filename);
26 $dir = scandir($path);
28 // "foobar.php.*" is a match
29 $base_file = basename($case->filename) . '.';
30 foreach ($dir as $file) {
31 if (strstr($file, $base_file) !== false) {
32 unlink("{$path}/{$file}");
37 public function getPriority()
39 return 100;
42 abstract protected function _isValid(PHPT_Case $case);