Skip to content

Commit 4d9140d

Browse files
Merge pull request #665 from jaredhendrickson13/next_patch
fix: correct internal callable name in IPsecChildSAStatus
2 parents bc95502 + ed2254d commit 4d9140d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/IPsecChildSAStatus.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class IPsecChildSAStatus extends Model {
4040

4141
public function __construct(mixed $id = null, mixed $parent_id = null, mixed $data = [], ...$options) {
4242
# Set model attributes
43-
$this->internal_callable = 'get_ipsec_child SA_statuses';
43+
$this->internal_callable = 'get_ipsec_sa_statuses';
4444
$this->parent_model_class = 'IPsecSAStatus';
4545
$this->verbose_name = 'IPsec Child SA Status';
4646
$this->many = true;

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests/APICoreModelTestCase.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)