Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / tests / PHPT / Section / PRESKIPIF.php
blob5d25ea4edf1d6c18143be85143d61a096b0e56b5
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;