public function DateRecurPartGridUnitTest::testSettingsToGridAllPartsForFrequencyAllowed in Recurring Dates Field 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Unit/DateRecurPartGridUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurPartGridUnitTest::testSettingsToGridAllPartsForFrequencyAllowed()
- 3.x tests/src/Unit/DateRecurPartGridUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurPartGridUnitTest::testSettingsToGridAllPartsForFrequencyAllowed()
- 3.1.x tests/src/Unit/DateRecurPartGridUnitTest.php \Drupal\Tests\date_recur\Unit\DateRecurPartGridUnitTest::testSettingsToGridAllPartsForFrequencyAllowed()
Tests config settings to grid helper.
@covers ::configSettingsToGrid
File
- tests/
src/ Unit/ DateRecurPartGridUnitTest.php, line 105
Class
- DateRecurPartGridUnitTest
- Tests part grid class.
Namespace
Drupal\Tests\date_recur\UnitCode
public function testSettingsToGridAllPartsForFrequencyAllowed() {
$parts = [
'all' => FALSE,
'frequencies' => [
'WEEKLY' => [],
'MONTHLY' => [
'*',
'BYSETPOS',
],
],
];
$partGrid = DateRecurPartGrid::configSettingsToGrid($parts);
// Test defined frequency no parts.
$this
->assertFalse($partGrid
->isFrequencyAllowed('WEEKLY'));
$this
->assertFalse($partGrid
->isPartAllowed('WEEKLY', 'BYSETPOS'));
// Test undefined frequency.
$this
->assertFalse($partGrid
->isFrequencyAllowed('DAILY'));
$this
->assertFalse($partGrid
->isPartAllowed('DAILY', 'BYSETPOS'));
// Test defined frequency.
$this
->assertTrue($partGrid
->isFrequencyAllowed('MONTHLY'));
// Test defined part.
$this
->assertTrue($partGrid
->isPartAllowed('MONTHLY', 'BYSETPOS'));
// Test undefined frequency.
$this
->assertTrue($partGrid
->isPartAllowed('MONTHLY', 'BYMONTH'));
}