Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features backwards compatibility #3728

Merged
merged 3 commits into from
Oct 29, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Unit test for set_settings_schema
  • Loading branch information
felipeelia committed Oct 29, 2023
commit 1b573c7d8b044e3896d56f60cd708546225f9a71
61 changes: 61 additions & 0 deletions tests/php/TestFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,65 @@ public function test_ep_feature_settings_schema_filter() {
$settings_schema
);
}

/**
* Test set_settings_schema.
*
* @group feature
*/
public function test_set_settings_schema() {
$stub = $this->getMockForAbstractClass( '\ElasticPress\Feature' );
$stub->slug = 'slug';
$stub->default_settings = [
'field_1' => '0',
'field_2' => '1',
'field_3' => 'text',
'field_4' => true,
'field_5' => false,
];

$this->assertSame(
[
[
'default' => false,
'key' => 'active',
'label' => 'Enable',
'requires_feature' => false,
'requires_sync' => false,
'type' => 'toggle',
],
[
'default' => '0',
'key' => 'field_1',
'label' => 'field_1',
'type' => 'checkbox',
],
[
'default' => '1',
'key' => 'field_2',
'label' => 'field_2',
'type' => 'checkbox',
],
[
'default' => 'text',
'key' => 'field_3',
'label' => 'field_3',
'type' => 'text',
],
[
'default' => true,
'key' => 'field_4',
'label' => 'field_4',
'type' => 'toggle',
],
[
'default' => false,
'key' => 'field_5',
'label' => 'field_5',
'type' => 'toggle',
],
],
$stub->get_settings_schema()
);
}
}
Loading