Code Duplication    Length = 12-16 lines in 2 locations

packages/abtest/tests/php/test-abtest.php 2 locations

@@ 77-88 (lines=12) @@
74
	 *
75
	 * @covers Automattic\Jetpack\Abtest::get_variation
76
	 */
77
	public function test_when_error_or_malformed_response() {
78
		$this->abtest->expects( $this->once() )
79
						->method( 'request_variation' )
80
						->willReturn(
81
							array(
82
								'status' => 500,
83
							)
84
						);
85
86
		$result = $this->abtest->get_variation( 'some_test' );
87
		$this->assertNull( $result );
88
	}
89
90
	/**
91
	 * Tests when the response is in an unexpected format.
@@ 95-110 (lines=16) @@
92
	 *
93
	 * @covers Automattic\Jetpack\Abtest::get_variation
94
	 */
95
	public function test_when_response_in_unexpected_format() {
96
		$this->abtest->expects( $this->once() )
97
						->method( 'request_variation' )
98
						->willReturn(
99
							array(
100
								'body' => json_encode( // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode
101
									array(
102
										'foo' => 'bar',
103
									)
104
								),
105
							)
106
						);
107
108
		$result = $this->abtest->get_variation( 'some_test' );
109
		$this->assertNull( $result );
110
	}
111
112
	/**
113
	 * Test with an active test.