add result property to Case (re #36)
[phpt.git] / tests / Case / calls-all-RunBefore-before-run.phpt
blobe407a1ee6551bba39ea1fc3007717aa8446b90b5
1 --TEST--
2 Any sections that implement the PHPT_Section_RunnableBefore interface are run prior
3 to running the FILE section
4 --FILE--
5 <?php
7 require_once dirname(__FILE__) . '/../_setup.inc';
9 class PHPT_Section_SimpleBeforeOne implements PHPT_Section_RunnableBefore {
10     public function run(PHPT_Case $case) {
11         echo __CLASS__ . " called\n";
12     }
13     
14     public function getPriority() { }
17 class PHPT_Section_SimpleBeforeTwo implements PHPT_Section_RunnableBefore {
18     public function run(PHPT_Case $case) {
19         echo __CLASS__ . " called\n";
20     }
21     
22     public function getPriority() { }
25 $file = new PHPT_Section_FILE("Hello World!\n");
26 $file->filename = dirname(__FILE__) . '/fake-test-case.php';
28 $case = new PHPT_Case(
29     new PHPT_SectionList(array(
30         new PHPT_Section_SimpleBeforeOne(),
31         new PHPT_Section_SimpleBeforeTwo(),
32         $file,
33     )),
34     dirname(__FILE__) . '/fake-test-case.phpt'
37 $case->run(new PHPT_Reporter_Null());
38 echo $case->output;
41 ===DONE===
42 --EXPECT--
43 PHPT_Section_SimpleBeforeOne called
44 PHPT_Section_SimpleBeforeTwo called
45 Hello World!
46 ===DONE===