Skip to content

Commit 58ecc92

Browse files
test: add unit tests for register_site_meta, and unregister_site_meta
1 parent 808861e commit 58ecc92

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

‎tests/phpunit/tests/meta/registerMeta.php‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,14 @@ public function test_get_object_subtype_for_blog_returns_empty_string_for_invali
11321132
$this->assertSame( '', get_object_subtype( 'blog', 999999 ) );
11331133
}
11341134

1135+
/**
1136+
* @ticket 44387
1137+
* @group ms-excluded
1138+
*/
1139+
public function test_get_object_subtype_for_blog_returns_empty_string_no_multisite() {
1140+
$this->assertSame( '', get_object_subtype( 'blog', 0 ) );
1141+
}
1142+
11351143
/**
11361144
* @ticket 44387
11371145
* @group ms-required
@@ -1191,4 +1199,34 @@ public function test_register_meta_with_revisions_enabled_on_post_type_without_r
11911199

11921200
$this->assertFalse( $register );
11931201
}
1202+
1203+
/**
1204+
* @ticket 44387
1205+
* @group ms-required
1206+
*/
1207+
public function test_register_site_meta_returns_true_on_success() {
1208+
if ( ! is_site_meta_supported() ) {
1209+
$this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' );
1210+
}
1211+
1212+
$result = register_site_meta( 'test_site_meta_key', array( 'single' => true ) );
1213+
unregister_site_meta( 'test_site_meta_key' );
1214+
1215+
$this->assertTrue( $result );
1216+
}
1217+
1218+
/**
1219+
* @ticket 44387
1220+
* @group ms-required
1221+
*/
1222+
public function test_unregister_site_meta_returns_true_on_success() {
1223+
if ( ! is_site_meta_supported() ) {
1224+
$this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' );
1225+
}
1226+
1227+
register_site_meta( 'test_site_meta_key', array( 'single' => true ) );
1228+
$result = unregister_site_meta( 'test_site_meta_key' );
1229+
1230+
$this->assertTrue( $result );
1231+
}
11941232
}

0 commit comments

Comments
 (0)