public function HookImplementationTest::testHookHideSchedulerFields in Scheduler content moderation integration 8
Tests if the Scheduler Publish-on and Unpublish-on fields should be hidden.
@dataProvider hideSchedulerFieldsProvider
File
- tests/
src/ Kernel/ HookImplementationTest.php, line 52
Class
- HookImplementationTest
- Tests the Scheduler hook functions implemented by this module.
Namespace
Drupal\Tests\scheduler_content_moderation_integration\KernelCode
public function testHookHideSchedulerFields($expected, $nodeChoice, $options) {
$node = $this->{$nodeChoice};
$form = [];
$form['publish_state']['widget'][0]['#options'] = $options;
$form['unpublish_state']['widget'][0]['#options'] = $options;
$result = scheduler_content_moderation_integration_scheduler_hide_publish_on_field($form, [], $node);
$this
->assertEquals($expected, $result, sprintf('Hide the publish-on field: Expected %s, Result %s', $expected ? 'Yes' : 'No', $result ? 'Yes' : 'No'));
$result = scheduler_content_moderation_integration_scheduler_hide_unpublish_on_field($form, [], $node);
$this
->assertEquals($expected, $result, sprintf('Hide the unpublish-on field: Expected %s, Result %s', $expected ? 'Yes' : 'No', $result ? 'Yes' : 'No'));
}