Code Duplication    Length = 7-7 lines in 4 locations

packages/status/tests/php/test-status.php 4 locations

@@ 150-156 (lines=7) @@
147
	 *
148
	 * @covers Automattic\Jetpack\Status::is_staging_site
149
	 */
150
	public function test_is_staging_wp_get_environment_type_local() {
151
		Functions\when( 'wp_get_environment_type' )->justReturn( 'local' );
152
153
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( false )->andReturn( false );
154
155
		$this->assertFalse( $this->status_obj->is_staging_site() );
156
	}
157
158
	/**
159
	 * Test when wp_get_environment_type is staging.
@@ 163-169 (lines=7) @@
160
	 *
161
	 * @covers Automattic\Jetpack\Status::is_staging_site
162
	 */
163
	public function test_is_staging_wp_get_environment_type_staging() {
164
		Functions\when( 'wp_get_environment_type' )->justReturn( 'staging' );
165
166
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( true )->andReturn( true );
167
168
		$this->assertTrue( $this->status_obj->is_staging_site() );
169
	}
170
171
	/**
172
	 * Test when wp_get_environment_type is production.
@@ 176-182 (lines=7) @@
173
	 *
174
	 * @covers Automattic\Jetpack\Status::is_staging_site
175
	 */
176
	public function test_is_staging_wp_get_environment_type_production() {
177
		Functions\when( 'wp_get_environment_type' )->justReturn( 'production' );
178
179
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( false )->andReturn( false );
180
181
		$this->assertFalse( $this->status_obj->is_staging_site() );
182
	}
183
184
	/**
185
	 * Test when wp_get_environment_type is a random value.
@@ 189-195 (lines=7) @@
186
	 *
187
	 * @covers Automattic\Jetpack\Status::is_staging_site
188
	 */
189
	public function test_is_staging_wp_get_environment_type_random() {
190
		Functions\when( 'wp_get_environment_type' )->justReturn( 'random_string' );
191
192
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( true )->andReturn( true );
193
194
		$this->assertTrue( $this->status_obj->is_staging_site() ); // We assume a site is a staging site for any non-local or non-production value.
195
	}
196
197
	/**
198
	 * Test when using the constant to set dev mode