@@ 220-233 (lines=14) @@ | ||
217 | // Run the tests! |
|
218 | $parser = $this->newParser( $data['args'] ); |
|
219 | try { |
|
220 | if ( isset( $data['changelog'] ) ) { |
|
221 | if ( isset( $data['parse-exception'] ) ) { |
|
222 | try { |
|
223 | $parser->parse( $data['changelog'] ); |
|
224 | $this->fail( 'Expected exception not thrown from parse()' ); |
|
225 | } catch ( Exception $ex ) { |
|
226 | $this->assertInstanceOf( get_class( $data['parse-exception'] ), $ex, 'Expected exception from parse()' ); |
|
227 | $this->assertStringContainsString( $data['parse-exception']->getMessage(), $ex->getMessage(), 'Expected exception from parse()' ); |
|
228 | } |
|
229 | } else { |
|
230 | $expect = isset( $data['parse-output'] ) ? $data['parse-output'] : $data['object']; |
|
231 | $this->assertEquals( $expect, $parser->parse( $data['changelog'] ), 'Output from parse()' ); |
|
232 | } |
|
233 | } |
|
234 | if ( isset( $data['object'] ) ) { |
|
235 | if ( isset( $data['format-exception'] ) ) { |
|
236 | try { |
|
@@ 234-247 (lines=14) @@ | ||
231 | $this->assertEquals( $expect, $parser->parse( $data['changelog'] ), 'Output from parse()' ); |
|
232 | } |
|
233 | } |
|
234 | if ( isset( $data['object'] ) ) { |
|
235 | if ( isset( $data['format-exception'] ) ) { |
|
236 | try { |
|
237 | $parser->format( $data['object'] ); |
|
238 | $this->fail( 'Expected exception not thrown from format()' ); |
|
239 | } catch ( Exception $ex ) { |
|
240 | $this->assertInstanceOf( get_class( $data['format-exception'] ), $ex, 'Expected exception from format()' ); |
|
241 | $this->assertStringContainsString( $data['format-exception']->getMessage(), $ex->getMessage(), 'Expected exception from format()' ); |
|
242 | } |
|
243 | } else { |
|
244 | $expect = isset( $data['format-output'] ) ? $data['format-output'] : $data['changelog']; |
|
245 | $this->assertEquals( $expect, $parser->format( $data['object'] ), 'Output from format()' ); |
|
246 | } |
|
247 | } |
|
248 | } catch ( Exception $ex ) { |
|
249 | if ( $this->updateFixtures ) { |
|
250 | // Re-run parse and format to get the new outputs for the fixture update. |