Skip to content

Commit e8b2b2c

Browse files
committed
A few test nitpicks.
1 parent 09d39d2 commit e8b2b2c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/phpunit/tests/block-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public function test_get_block_template_from_registry() {
467467

468468
$template = get_block_template( 'block-theme//test-template' );
469469

470-
$this->assertEquals( 'Test Template', $template->title );
470+
$this->assertSame( 'Test Template', $template->title );
471471

472472
wp_unregister_block_template( $template_name );
473473
}

tests/phpunit/tests/block-templates/WpBlockTemplatesRegistry.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function test_register_template_invalid_name() {
4848
$this->setExpectedIncorrectUsage( 'WP_Block_Templates_Registry::register' );
4949
$result = self::$registry->register( $template_name );
5050

51-
$this->assertWPError( $result );
51+
$this->assertWPError( $result, 'Template registration is expected to trigger an error.' );
5252
$this->assertSame( 'template_name_no_string', $result->get_error_code(), 'Error code mismatch.' );
5353
$this->assertSame( 'Template names must be strings.', $result->get_error_message(), 'Error message mismatch.' );
5454
}
@@ -68,7 +68,7 @@ public function test_register_template_invalid_name_uppercase() {
6868
$this->setExpectedIncorrectUsage( 'WP_Block_Templates_Registry::register' );
6969
$result = self::$registry->register( $template_name );
7070

71-
$this->assertWPError( $result );
71+
$this->assertWPError( $result, 'Template registration is expected to trigger an error.' );
7272
$this->assertSame( 'template_name_no_uppercase', $result->get_error_code(), 'Error code mismatch.' );
7373
$this->assertSame( 'Template names must not contain uppercase characters.', $result->get_error_message(), 'Error message mismatch.' );
7474
}
@@ -85,7 +85,7 @@ public function test_register_template_no_prefix() {
8585
$this->setExpectedIncorrectUsage( 'WP_Block_Templates_Registry::register' );
8686
$result = self::$registry->register( 'template-no-plugin', array() );
8787

88-
$this->assertWPError( $result );
88+
$this->assertWPError( $result, 'Template registration is expected to trigger an error.' );
8989
$this->assertSame( 'template_no_prefix', $result->get_error_code(), 'Error code mismatch.' );
9090
$this->assertSame( 'Template names must contain a namespace prefix. Example: my-plugin//my-custom-template', $result->get_error_message(), 'Error message mismatch.' );
9191
}
@@ -106,7 +106,7 @@ public function test_register_template_already_exists() {
106106
$this->setExpectedIncorrectUsage( 'WP_Block_Templates_Registry::register' );
107107
$result = self::$registry->register( $template_name );
108108

109-
$this->assertWPError( $result );
109+
$this->assertWPError( $result, 'Template registration is expected to trigger an error.' );
110110
$this->assertSame( 'template_already_registered', $result->get_error_code(), 'Error code mismatch.' );
111111
$this->assertStringContainsString( 'Template "test-plugin//duplicate-template" is already registered.', $result->get_error_message(), 'Error message mismatch.' );
112112

@@ -164,7 +164,7 @@ public function test_get_registered() {
164164
$this->assertSame( 'Description of registered template', $registered_template->description, 'Template description mismatch.' );
165165
$this->assertSame( 'plugin', $registered_template->source, "Template source should be 'plugin'." );
166166
$this->assertSame( 'plugin', $registered_template->origin, "Template origin should be 'plugin'." );
167-
$this->assertEquals( array( 'post', 'page' ), $registered_template->post_types, 'Template post types mismatch.' );
167+
$this->assertSameSets( array( 'post', 'page' ), $registered_template->post_types, 'Template post types mismatch.' );
168168
$this->assertSame( 'test-plugin', $registered_template->plugin, 'Plugin name mismatch.' );
169169

170170
self::$registry->unregister( $template_name );

0 commit comments

Comments
 (0)