Skip to content

Commit 8ce9158

Browse files
committed
Add tests
1 parent 9a146a5 commit 8ce9158

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

tests/e2e/abilities-internal-post-types.spec.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* E2E tests for SCF Internal Post Type Abilities (Post Types and Taxonomies)
2+
* E2E tests for SCF Internal Post Type Abilities (Post Types, Taxonomies, and UI Options Pages)
33
*
4-
* Tests the WordPress Abilities API endpoints for SCF post type and taxonomy management.
5-
* Both entity types share the same base class, so tests are parameterized.
4+
* Tests the WordPress Abilities API endpoints for SCF internal post type management.
5+
* All entity types share the same base class, so tests are parameterized.
66
*
77
* HTTP Method Reference:
88
* - Read-only abilities (readonly: true) → GET with bracket notation: { 'input[key]': value }
@@ -43,6 +43,17 @@ const ENTITY_TYPES = [
4343
taxonomy: 'e2e_test_tax',
4444
},
4545
},
46+
{
47+
name: 'UI Options Page',
48+
slug: 'ui-options-page',
49+
slugPlural: 'ui-options-pages',
50+
identifierKey: 'menu_slug',
51+
testEntity: {
52+
key: 'ui_options_page_e2e_test',
53+
title: 'E2E Test Options Page',
54+
menu_slug: 'e2e-test-options',
55+
},
56+
},
4657
];
4758

4859
// Shared helper functions

tests/php/includes/abilities/test-scf-internal-post-type-abilities.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@
1313
// Load mock Abilities API functions before loading the class.
1414
require_once __DIR__ . '/abilities-api-mocks.php';
1515

16-
// Load ACF internal post type class to register the taxonomy instance.
16+
// Load ACF internal post type classes.
17+
require_once dirname( __DIR__, 4 ) . '/includes/post-types/class-acf-post-type.php';
1718
require_once dirname( __DIR__, 4 ) . '/includes/post-types/class-acf-taxonomy.php';
19+
require_once dirname( __DIR__, 4 ) . '/includes/post-types/class-acf-ui-options-page.php';
1820

1921
// Load the abilities classes after ACF classes are loaded.
2022
require_once dirname( __DIR__, 4 ) . '/includes/abilities/class-scf-internal-post-type-abilities.php';
23+
require_once dirname( __DIR__, 4 ) . '/includes/abilities/class-scf-post-type-abilities.php';
2124
require_once dirname( __DIR__, 4 ) . '/includes/abilities/class-scf-taxonomy-abilities.php';
25+
require_once dirname( __DIR__, 4 ) . '/includes/abilities/class-scf-ui-options-page-abilities.php';
2226

2327
/**
2428
* Tests for SCF_Internal_Post_Type_Abilities base class
@@ -1006,4 +1010,26 @@ public function test_list_callback_success() {
10061010
$this->assertIsArray( $result );
10071011
$this->assertCount( 2, $result );
10081012
}
1013+
1014+
/**
1015+
* Test UI Options Page abilities class instantiates correctly.
1016+
*
1017+
* Ensures coverage for the UI Options Page abilities class which
1018+
* extends the base class with minimal customization.
1019+
*/
1020+
public function test_ui_options_page_abilities_instantiates() {
1021+
$abilities = new SCF_UI_Options_Page_Abilities();
1022+
$this->assertInstanceOf( SCF_Internal_Post_Type_Abilities::class, $abilities );
1023+
}
1024+
1025+
/**
1026+
* Test Post Type abilities class instantiates correctly.
1027+
*
1028+
* Ensures coverage for the Post Type abilities class which
1029+
* extends the base class with minimal customization.
1030+
*/
1031+
public function test_post_type_abilities_instantiates() {
1032+
$abilities = new SCF_Post_Type_Abilities();
1033+
$this->assertInstanceOf( SCF_Internal_Post_Type_Abilities::class, $abilities );
1034+
}
10091035
}

0 commit comments

Comments
 (0)