Code Duplication    Length = 7-7 lines in 4 locations

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

@@ 132-138 (lines=7) @@
129
	 *
130
	 * @covers Automattic\Jetpack\Status::is_staging_site
131
	 */
132
	public function test_is_staging_wp_get_environment_type_local() {
133
		Functions\when( 'wp_get_environment_type' )->justReturn( 'local' );
134
135
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( false )->andReturn( false );
136
137
		$this->assertFalse( $this->status_obj->is_staging_site() );
138
	}
139
140
	/**
141
	 * Test when wp_get_environment_type is staging.
@@ 145-151 (lines=7) @@
142
	 *
143
	 * @covers Automattic\Jetpack\Status::is_staging_site
144
	 */
145
	public function test_is_staging_wp_get_environment_type_staging() {
146
		Functions\when( 'wp_get_environment_type' )->justReturn( 'staging' );
147
148
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( false )->andReturn( false );
149
150
		$this->assertTrue( $this->status_obj->is_staging_site() );
151
	}
152
153
	/**
154
	 * Test when wp_get_environment_type is production.
@@ 158-164 (lines=7) @@
155
	 *
156
	 * @covers Automattic\Jetpack\Status::is_staging_site
157
	 */
158
	public function test_is_staging_wp_get_environment_type_production() {
159
		Functions\when( 'wp_get_environment_type' )->justReturn( 'production' );
160
161
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( false )->andReturn( false );
162
163
		$this->assertFalse( $this->status_obj->is_staging_site() );
164
	}
165
166
	/**
167
	 * Test when wp_get_environment_type is a random value.
@@ 171-177 (lines=7) @@
168
	 *
169
	 * @covers Automattic\Jetpack\Status::is_staging_site
170
	 */
171
	public function test_is_staging_wp_get_environment_type_random() {
172
		Functions\when( 'wp_get_environment_type' )->justReturn( 'random_string' );
173
174
		Filters\expectApplied( 'jetpack_is_staging_site' )->once()->with( false )->andReturn( false );
175
176
		$this->assertTrue( $this->status_obj->is_staging_site() ); // We assume a site is a staging site for any non-local or non-production value.
177
	}
178
179
	/**
180
	 * Test when using the constant to set dev mode