XbConfigEntityHttpApiTest::testJavaScriptComponent test comments are incorrect regarding status updating

Created on 11 April 2025, 10 days ago

Overview

Reading through \Drupal\Tests\experience_builder\Functional\XbConfigEntityHttpApiTest::testJavaScriptComponent for another issue I ran across this block

// โš ๏ธThis is changing it from `exposed` โ†’ `internal`. This must cause the
    // `Component` config entity to continue to exist, but get its `status` to
    // change to `FALSE`, and cause it to be omitted from the list of available
    // components for the Content Creator.
    // @todo https://www.drupal.org/i/3500043 will disallow PATCHing this if > 0 uses of this component exist.
    $code_component_to_send['status'] = FALSE;
    $expected_component['status'] = FALSE;
    $request_options[RequestOptions::BODY] = self::encodeXBData($code_component_to_send);
    $body = $this->assertExpectedResponse('PATCH', Url::fromUri('base:/xb/api/config/js_component/test'), $request_options, 200, NULL, NULL, NULL, NULL);
    $this->assertSame($expected_component, $body);
    // Confirm that the code component IS exposed, because `status` was just
    // changed to `TRUE`.
    // @see docs/config-management.md#3.2.1
    $this->assertNotNull(Component::load('js.test'));
    $this->assertFalse(Component::load('js.test')->status());
    $this->assertExposedCodeComponents([], 'MISS', $request_options);
    $this->assertExposedCodeComponents([], 'HIT', $request_options);

This comment here is at least wrong

/ Confirm that the code component IS exposed, because `status` was just
 // changed to `TRUE`.

Because above we actual set it to false the assert below show that IS NOT exposed.

If you search for "// Confirm that the code component IS exposed, because" you will see that same comment is repeated above this where it actually true. Probably just a case of copying the code block to test setting to false and updating the assertions but not the comments

I have not read through the rest of the comments but we should probably check them too

Proposed resolution

Fix the comments

๐Ÿ› Bug report
Status

Active

Version

0.0

Component

Internal HTTP API

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States tedbow Ithaca, NY, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024