Chris@13: setPass(new ExitPass()); Chris@13: } Chris@13: Chris@13: /** Chris@13: * @dataProvider dataProviderExitStatement Chris@13: */ Chris@13: public function testExitStatement($from, $to) Chris@13: { Chris@13: $this->assertProcessesAs($from, $to); Chris@13: } Chris@13: Chris@13: /** Chris@13: * Data provider for testExitStatement. Chris@13: * Chris@13: * @return array Chris@13: */ Chris@13: public function dataProviderExitStatement() Chris@13: { Chris@13: return [ Chris@13: ['exit;', "{$this->expectedExceptionString};"], Chris@13: ['exit();', "{$this->expectedExceptionString};"], Chris@13: ['die;', "{$this->expectedExceptionString};"], Chris@13: ['exit(die(die));', "{$this->expectedExceptionString};"], Chris@13: ['if (true) { exit; }', "if (true) {\n {$this->expectedExceptionString};\n}"], Chris@13: ['if (false) { exit; }', "if (false) {\n {$this->expectedExceptionString};\n}"], Chris@13: ['1 and exit();', "1 and {$this->expectedExceptionString};"], Chris@13: ['foo() or die', "foo() or {$this->expectedExceptionString};"], Chris@13: ['exit and 1;', "{$this->expectedExceptionString} and 1;"], Chris@13: ['if (exit) { echo $wat; }', "if ({$this->expectedExceptionString}) {\n echo \$wat;\n}"], Chris@13: ['exit or die;', "{$this->expectedExceptionString} or {$this->expectedExceptionString};"], Chris@13: ['switch (die) { }', "switch ({$this->expectedExceptionString}) {\n}"], Chris@13: ['for ($i = 1; $i < 10; die) {}', "for (\$i = 1; \$i < 10; {$this->expectedExceptionString}) {\n}"], Chris@13: ]; Chris@13: } Chris@13: }