File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1248,4 +1248,23 @@ class APICoreModelTestCase extends RESTAPI\Core\TestCase {
12481248 $ dhcp_server ->staticmap ->value = [];
12491249 $ dhcp_server ->update (apply: true );
12501250 }
1251+
1252+ /**
1253+ * Checks that all Model classes with an internal_callable assigned have an existing callable assigned.
1254+ */
1255+ public function test_model_internal_callables_exist (): void {
1256+ # Loop through all Model classes
1257+ foreach (Model::get_all_model_classes () as $ model_class ) {
1258+ # Create a new instance of the Model class
1259+ $ model_obj = new $ model_class (skip_init: true );
1260+
1261+ # Skip models that don't have an internal callable assigned
1262+ if (!$ model_obj ->internal_callable ) {
1263+ continue ;
1264+ }
1265+
1266+ # Ensure the internal callable exists
1267+ $ this ->assert_is_true (method_exists ($ model_obj , $ model_obj ->internal_callable ));
1268+ }
1269+ }
12511270}
You can’t perform that action at this time.
0 commit comments