diff --git a/tests/test-cmb-core.php b/tests/test-cmb-core.php index ef75b4d54..97f3eed96 100644 --- a/tests/test-cmb-core.php +++ b/tests/test-cmb-core.php @@ -61,6 +61,23 @@ public function setUp() { ) ); + $this->user_metabox_array = array( + 'id' => 'user_metabox', + 'title' => 'User Profile Metabox', + 'object_types' => array( 'user' ), // Tells CMB2 to use user_meta vs post_meta + 'show_names' => true, + 'new_user_section' => 'add-new-user', // where form will show on new user page. 'add-existing-user' is only other valid option. + 'fields' => array( + 'extra_info' => array( + 'name' => 'Extra Info', + 'desc' => 'field description (optional)', + 'id' => 'extra_info', + 'type' => 'title', + 'on_front' => false, + ) + ) + ); + $this->defaults = array( 'id' => $this->cmb_id, 'title' => '', @@ -183,6 +200,9 @@ public function test_cmb2_get_metabox() { $cmb1 = cmb2_get_metabox( $this->metabox_array2 ); $cmb2 = new CMB2( $this->metabox_array2 ); $this->assertEquals( $cmb1, $cmb2 ); + + $cmb_user = cmb2_get_metabox( $this->user_metabox_array ); + $this->assertEquals( 'user', $cmb_user->mb_object_type() ); } public function test_cmb2_get_field() {