Skip to content

Commit 978ac79

Browse files
Extract image_size key into variable
Avoids repeating the string literal for the array key in the enum assertion test.
1 parent 458d94c commit 978ac79

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/phpunit/tests/rest-api/rest-attachments-controller.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,8 +3253,9 @@ public function test_sideload_route_includes_scaled_enum() {
32533253
$endpoint = $route[0];
32543254
$args = $endpoint['args'];
32553255

3256-
$this->assertArrayHasKey( 'image_size', $args, 'Route should have image_size arg.' );
3257-
$this->assertContains( 'scaled', $args['image_size']['enum'], 'image_size enum should include scaled.' );
3256+
$param_name = 'image_size';
3257+
$this->assertArrayHasKey( $param_name, $args, 'Route should have image_size arg.' );
3258+
$this->assertContains( 'scaled', $args[ $param_name ]['enum'], 'image_size enum should include scaled.' );
32583259
}
32593260

32603261
/**

0 commit comments

Comments
 (0)