More support for white-space.
[htmlpurifier.git] / tests / PHPT / Section / PRESKIPIF.php
blob4691c76daf759a988f008bffd8d704b2b818dedb
1 <?php
3 class PHPT_Section_PRESKIPIF implements PHPT_Section_RunnableBefore
5 private $_data = null;
6 private $_runner_factory = null;
8 public function __construct($data)
10 $this->_data = $data;
11 $this->_runner_factory = new PHPT_CodeRunner_Factory();
14 public function run(PHPT_Case $case)
16 // @todo refactor this code into PHPT_Util class as its used in multiple places
17 $filename = dirname($case->filename) . '/' . basename($case->filename, '.php') . '.skip.php';
19 // @todo refactor to PHPT_CodeRunner
20 file_put_contents($filename, $this->_data);
21 $runner = $this->_runner_factory->factory($case);
22 $runner->ini = "";
23 $response = $runner->run($filename)->output;
24 unlink($filename);
26 if (preg_match('/^skip( - (.*))?/', $response, $matches)) {
27 $message = !empty($matches[2]) ? $matches[2] : '';
28 throw new PHPT_Case_VetoException($message);
32 public function getPriority()
34 return -2;