Code Duplication    Length = 10-10 lines in 3 locations

projects/packages/changelogger/tests/php/tests/lib/ChangeEntryTest.php 1 location

@@ 405-414 (lines=10) @@
402
	 * @param string             $json JSON data.
403
	 * @param ChangeEntry|string $change Change entry, or error message if decoding should fail.
404
	 */
405
	public function testJson( $json, $change ) {
406
		if ( is_string( $change ) ) {
407
			$this->expectException( InvalidArgumentException::class );
408
			$this->expectExceptionMessage( $change );
409
			ChangeEntry::jsonUnserialize( json_decode( $json ) );
410
		} else {
411
			$this->assertSame( $json, json_encode( $change ) );
412
			$this->assertEquals( $change, ChangeEntry::jsonUnserialize( json_decode( $json ) ) );
413
		}
414
	}
415
416
	/**
417
	 * Data provider for testJson.

projects/packages/changelogger/tests/php/tests/lib/ChangelogEntryTest.php 1 location

@@ 217-226 (lines=10) @@
214
	 * @param string                $json JSON data.
215
	 * @param ChangelogEntry|string $entry Changelog entry, or error message if decoding should fail.
216
	 */
217
	public function testJson( $json, $entry ) {
218
		if ( is_string( $entry ) ) {
219
			$this->expectException( InvalidArgumentException::class );
220
			$this->expectExceptionMessage( $entry );
221
			ChangelogEntry::jsonUnserialize( json_decode( $json ) );
222
		} else {
223
			$this->assertSame( $json, json_encode( $entry ) );
224
			$this->assertEquals( $entry, ChangelogEntry::jsonUnserialize( json_decode( $json ) ) );
225
		}
226
	}
227
228
	/**
229
	 * Data provider for testJson.

projects/packages/changelogger/tests/php/tests/lib/ChangelogTest.php 1 location

@@ 117-126 (lines=10) @@
114
	 * @param string           $json JSON data.
115
	 * @param Changelog|string $changelog Changelog, or error message if decoding should fail.
116
	 */
117
	public function testJson( $json, $changelog ) {
118
		if ( is_string( $changelog ) ) {
119
			$this->expectException( InvalidArgumentException::class );
120
			$this->expectExceptionMessage( $changelog );
121
			Changelog::jsonUnserialize( json_decode( $json ) );
122
		} else {
123
			$this->assertSame( $json, json_encode( $changelog ) );
124
			$this->assertEquals( $changelog, Changelog::jsonUnserialize( json_decode( $json ) ) );
125
		}
126
	}
127
128
	/**
129
	 * Data provider for testJson.