Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class IPsecChildSAStatus extends Model {

public function __construct(mixed $id = null, mixed $parent_id = null, mixed $data = [], ...$options) {
# Set model attributes
$this->internal_callable = 'get_ipsec_child SA_statuses';
$this->internal_callable = 'get_ipsec_sa_statuses';
$this->parent_model_class = 'IPsecSAStatus';
$this->verbose_name = 'IPsec Child SA Status';
$this->many = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1248,4 +1248,23 @@ class APICoreModelTestCase extends RESTAPI\Core\TestCase {
$dhcp_server->staticmap->value = [];
$dhcp_server->update(apply: true);
}

/**
* Checks that all Model classes with an internal_callable assigned have an existing callable assigned.
*/
public function test_model_internal_callables_exist(): void {
# Loop through all Model classes
foreach (Model::get_all_model_classes() as $model_class) {
# Create a new instance of the Model class
$model_obj = new $model_class(skip_init: true);

# Skip models that don't have an internal callable assigned
if (!$model_obj->internal_callable) {
continue;
}

# Ensure the internal callable exists
$this->assert_is_true(method_exists($model_obj, $model_obj->internal_callable));
}
}
}