From 74bc3514bef0308d00b89979361226d54903eb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20W=C3=BCnsch?= Date: Tue, 15 Sep 2026 11:05:05 +0200 Subject: [PATCH] Tests: Fix ineffective assertions in the block renderer controller tests. `REST_Block_Renderer_Controller_Test::test_get_item_schema()` called `arrayHasKey()` instead of `assertArrayHasKey()`. That method only builds a constraint object and returns it, so both lines were silently discarded and never verified anything. The first call becomes `assertArrayHasKey()`. The second one cannot: the `rendered` property's `type` is the string `string`, not an array, and `assertArrayHasKey()` rejects a non-array haystack. It is replaced with `assertSame( 'string', ... )`, which is the assertion that was intended. --- .../phpunit/tests/rest-api/rest-block-renderer-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php index 3573ecb6e0bea..156955c9642d4 100644 --- a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php @@ -601,8 +601,8 @@ public function test_get_item_schema() { $this->assertArrayHasKey( 'schema', $data ); $this->assertSame( 'rendered-block', $data['schema']['title'] ); $this->assertSame( 'object', $data['schema']['type'] ); - $this->arrayHasKey( 'rendered', $data['schema']['properties'] ); - $this->arrayHasKey( 'string', $data['schema']['properties']['rendered']['type'] ); + $this->assertArrayHasKey( 'rendered', $data['schema']['properties'] ); + $this->assertSame( 'string', $data['schema']['properties']['rendered']['type'] ); $this->assertSame( array( 'edit' ), $data['schema']['properties']['rendered']['context'] ); }