Code Duplication    Length = 14-14 lines in 2 locations

projects/packages/changelogger/tests/php/src/lib/ParserTestCase.php 2 locations

@@ 184-197 (lines=14) @@
181
		$parser = $this->newParser( $data['args'] );
182
183
		try {
184
			if ( isset( $data['changelog'] ) ) {
185
				if ( isset( $data['parse-exception'] ) ) {
186
					try {
187
						$parser->parse( $data['changelog'] );
188
						$this->fail( 'Expected exception not thrown from parse()' );
189
					} catch ( Exception $ex ) {
190
						$this->assertInstanceOf( get_class( $data['parse-exception'] ), $ex, 'Expected exception from parse()' );
191
						$this->assertStringContainsString( $data['parse-exception']->getMessage(), $ex->getMessage(), 'Expected exception from parse()' );
192
					}
193
				} else {
194
					$expect = isset( $data['parse-output'] ) ? $data['parse-output'] : $data['object'];
195
					$this->assertEquals( $expect, $parser->parse( $data['changelog'] ), 'Output from parse()' );
196
				}
197
			}
198
			if ( isset( $data['object'] ) ) {
199
				if ( isset( $data['format-exception'] ) ) {
200
					try {
@@ 198-211 (lines=14) @@
195
					$this->assertEquals( $expect, $parser->parse( $data['changelog'] ), 'Output from parse()' );
196
				}
197
			}
198
			if ( isset( $data['object'] ) ) {
199
				if ( isset( $data['format-exception'] ) ) {
200
					try {
201
						$parser->format( $data['object'] );
202
						$this->fail( 'Expected exception not thrown from format()' );
203
					} catch ( Exception $ex ) {
204
						$this->assertInstanceOf( get_class( $data['format-exception'] ), $ex, 'Expected exception from format()' );
205
						$this->assertStringContainsString( $data['format-exception']->getMessage(), $ex->getMessage(), 'Expected exception from format()' );
206
					}
207
				} else {
208
					$expect = isset( $data['format-output'] ) ? $data['format-output'] : $data['changelog'];
209
					$this->assertEquals( $expect, $parser->format( $data['object'] ), 'Output from format()' );
210
				}
211
			}
212
		} catch ( Exception $ex ) {
213
			if ( $this->updateFixtures ) {
214
				unset( $data['parse-output'], $data['parse-exception'], $data['format-output'], $data['format-exception'] );