add @todo note
[phpt.git] / src / PHPT / Section / POST.php
blob94788fb581b622d47b7dbccbecd3be43a872c250
1 <?php
3 class PHPT_Section_POST implements PHPT_Section_RunnableBefore, PHPT_Section_ENVModifier
5 public $file = '';
6 public $raw_data = '';
8 public function __construct($data = '')
10 if (!empty($data)) {
11 $this->file = uniqid();
13 $this->raw_data = $data;
16 public function __destruct()
18 // surpress in case run() is never called
19 @unlink($this->file);
22 public function run(PHPT_Case $case)
24 file_put_contents($this->file, $this->raw_data);
27 public function getPriority()
29 return 50;
32 public function modifyEnv(PHPT_Section_ENV $env)
34 $env->data['REQUEST_METHOD'] = 'POST';
35 $env->data['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
36 $env->data['CONTENT_LENGTH'] = strlen($this->raw_data);