Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try: Set show_in_rest to true by default when label argument is defined #7302

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adapt unit tests
SantosGuillamot committed Sep 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit edc444cb9b5258a000fbecfc76d267b634f2b3e9
15 changes: 15 additions & 0 deletions tests/phpunit/tests/meta/registerMeta.php
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ public function test_register_meta_with_post_object_type_populates_wp_meta_keys(
'' => array(
'flight_number' => array(
'type' => 'string',
'label' => '',
'description' => '',
'single' => false,
'sanitize_callback' => null,
@@ -117,6 +118,7 @@ public function test_register_meta_with_term_object_type_populates_wp_meta_keys(
'' => array(
'category_icon' => array(
'type' => 'string',
'label' => '',
'description' => '',
'single' => false,
'sanitize_callback' => null,
@@ -172,6 +174,7 @@ public function test_register_meta_with_current_sanitize_callback_populates_wp_m
'' => array(
'flight_number' => array(
'type' => 'string',
'label' => '',
'description' => '',
'single' => false,
'sanitize_callback' => array( $this, '_new_sanitize_meta_cb' ),
@@ -256,6 +259,16 @@ public function test_get_registered_meta_keys_with_invalid_type_is_empty() {
$this->assertEmpty( $meta_keys );
}

public function test_get_registered_meta_keys_label_arg() {
register_meta( 'post', 'registered_key1', array( 'label' => 'Field label' ) );

$meta_keys = get_registered_meta_keys( 'post' );

unregister_meta_key( 'post', 'registered_key1' );

$this->assertSame( 'Field label', $meta_keys['registered_key1']['label'] );
}

public function test_get_registered_meta_keys_description_arg() {
register_meta( 'post', 'registered_key1', array( 'description' => 'I\'m just a field, take a good look at me' ) );

@@ -340,6 +353,7 @@ public function test_register_meta_with_subtype_populates_wp_meta_keys( $type, $
$subtype => array(
'flight_number' => array(
'type' => 'string',
'label' => '',
'description' => '',
'single' => false,
'sanitize_callback' => null,
@@ -394,6 +408,7 @@ public function test_unregister_meta_without_subtype_keeps_subtype_meta_key( $ty
$subtype => array(
'flight_number' => array(
'type' => 'string',
'label' => '',
'description' => '',
'single' => false,
'sanitize_callback' => null,
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ public function test_should_register_persisted_preferences_meta() {
$this->assertSame(
array(
'type' => 'object',
'label' => '',
'description' => '',
'single' => true,
'sanitize_callback' => null,

Unchanged files with check annotations Beta

await expect(
page,
'should redirect to the installation page'
).toHaveURL( /wp-admin\/install\.php$/ );

Check failure on line 40 in tests/e2e/specs/install.test.js

GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests

[chromium] › install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials

1) [chromium] › install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials Error: should redirect to the installation page Timed out 5000ms waiting for expect(locator).toHaveURL(expected) Locator: locator(':root') Expected pattern: /wp-admin\/install\.php$/ Received string: "http://localhost:8889/" Call log: - should redirect to the installation page with timeout 5000ms - waiting for locator(':root') - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" 38 | page, 39 | 'should redirect to the installation page' > 40 | ).toHaveURL( /wp-admin\/install\.php$/ ); | ^ 41 | 42 | await expect( 43 | page.getByText( /WordPress database error/ ), at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/install.test.js:40:5

Check failure on line 40 in tests/e2e/specs/install.test.js

GitHub Actions / Test with SCRIPT_DEBUG enabled / Run E2E tests

[chromium] › install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials

1) [chromium] › install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials Error: should redirect to the installation page Timed out 5000ms waiting for expect(locator).toHaveURL(expected) Locator: locator(':root') Expected pattern: /wp-admin\/install\.php$/ Received string: "http://localhost:8889/" Call log: - should redirect to the installation page with timeout 5000ms - waiting for locator(':root') - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" - locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" 38 | page, 39 | 'should redirect to the installation page' > 40 | ).toHaveURL( /wp-admin\/install\.php$/ ); | ^ 41 | 42 | await expect( 43 | page.getByText( /WordPress database error/ ), at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/install.test.js:40:5
await expect(
page.getByText( /WordPress database error/ ),
await applicationPasswords.create();
const [ app ] = await applicationPasswords.get();
expect( app['name']).toBe( TEST_APPLICATION_NAME );

Check failure on line 26 in tests/e2e/specs/profile/applications-passwords.test.js

GitHub Actions / Test with SCRIPT_DEBUG enabled / Run E2E tests

[chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password

2) [chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── TypeError: Cannot read properties of undefined (reading 'name') 24 | 25 | const [ app ] = await applicationPasswords.get(); > 26 | expect( app['name']).toBe( TEST_APPLICATION_NAME ); | ^ 27 | 28 | const successMessage = page.getByRole( 'alert' ); 29 | at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/profile/applications-passwords.test.js:26:14
const successMessage = page.getByRole( 'alert' );
}
async create(applicationName = TEST_APPLICATION_NAME) {
await this.admin.visitAdminPage( '/profile.php' );

Check failure on line 110 in tests/e2e/specs/profile/applications-passwords.test.js

GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests

[chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password

2) [chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password Error: Not logged in 108 | 109 | async create(applicationName = TEST_APPLICATION_NAME) { > 110 | await this.admin.visitAdminPage( '/profile.php' ); | ^ 111 | 112 | const newPasswordField = this.page.getByRole( 'textbox', { name: 'New Application Password Name' } ); 113 | await expect( newPasswordField ).toBeVisible(); at Admin.visitAdminPage (/home/runner/work/wordpress-develop/wordpress-develop/node_modules/@wordpress/e2e-test-utils-playwright/src/admin/visit-admin-page.ts:36:9) at ApplicationPasswords.create (/home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/profile/applications-passwords.test.js:110:3) at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/profile/applications-passwords.test.js:23:3

Check failure on line 110 in tests/e2e/specs/profile/applications-passwords.test.js

GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests

[chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password

2) [chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Not logged in 108 | 109 | async create(applicationName = TEST_APPLICATION_NAME) { > 110 | await this.admin.visitAdminPage( '/profile.php' ); | ^ 111 | 112 | const newPasswordField = this.page.getByRole( 'textbox', { name: 'New Application Password Name' } ); 113 | await expect( newPasswordField ).toBeVisible(); at Admin.visitAdminPage (/home/runner/work/wordpress-develop/wordpress-develop/node_modules/@wordpress/e2e-test-utils-playwright/src/admin/visit-admin-page.ts:36:9) at ApplicationPasswords.create (/home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/profile/applications-passwords.test.js:110:3) at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/profile/applications-passwords.test.js:23:3

Check failure on line 110 in tests/e2e/specs/profile/applications-passwords.test.js

GitHub Actions / Test with SCRIPT_DEBUG enabled / Run E2E tests

[chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password

2) [chromium] › profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password Error: Not logged in 108 | 109 | async create(applicationName = TEST_APPLICATION_NAME) { > 110 | await this.admin.visitAdminPage( '/profile.php' ); | ^ 111 | 112 | const newPasswordField = this.page.getByRole( 'textbox', { name: 'New Application Password Name' } ); 113 | await expect( newPasswordField ).toBeVisible(); at Admin.visitAdminPage (/home/runner/work/wordpress-develop/wordpress-develop/node_modules/@wordpress/e2e-test-utils-playwright/src/admin/visit-admin-page.ts:36:9) at ApplicationPasswords.create (/home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/profile/applications-passwords.test.js:110:3) at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/profile/applications-passwords.test.js:23:3
const newPasswordField = this.page.getByRole( 'textbox', { name: 'New Application Password Name' } );
await expect( newPasswordField ).toBeVisible();