private function CacheFlushAdvancedTest::interfaceErrorrs in CacheFlush 8
Check if errors are generated correctly.
1 call to CacheFlushAdvancedTest::interfaceErrorrs()
- CacheFlushAdvancedTest::setUp in modules/
cacheflush_advanced/ tests/ src/ Functional/ CacheFlushAdvancedTest.php - Sets up the test.
File
- modules/
cacheflush_advanced/ tests/ src/ Functional/ CacheFlushAdvancedTest.php, line 54
Class
- CacheFlushAdvancedTest
- Test cacheflush advanced functionality.
Namespace
Drupal\Tests\cacheflush_advanced\FunctionalCode
private function interfaceErrorrs() {
// Check interface has all fields.
$this
->drupalGet('admin/structure/cacheflush/add');
$this
->assertRaw(t('Custom (advanced)'));
$this
->assertFieldByName('vertical_tabs_advance[cacheflush_advanced_table][0][cid]');
$this
->assertFieldByName('vertical_tabs_advance[cacheflush_advanced_table][0][table]');
$this
->assertFieldByName('advanced_remove_0');
$this
->assertFieldByName('advance_add');
// Test NO error generate if nothing completet on the advanced form.
$this
->drupalPostForm(NULL, [], t('Save'));
$this
->assertNoRaw(t('Cache ID is required!'));
$this
->assertNoRaw(t('Service is required!'));
// Test if CID sett and service not, is generating error.
$this
->drupalPostForm(NULL, [
'vertical_tabs_advance[cacheflush_advanced_table][0][cid]' => 'Test 1',
], t('Save'));
$this
->assertNoRaw(t('Cache ID is required!'));
$this
->assertRaw(t('Service is required'));
// Test if CID not and service sett, is generating error.
$this
->drupalPostForm(NULL, [
'vertical_tabs_advance[cacheflush_advanced_table][0][cid]' => '',
'vertical_tabs_advance[cacheflush_advanced_table][0][table]' => 'menu',
], t('Save'));
$this
->assertRaw(t('Cache ID is required!'));
$this
->assertNoRaw(t('Service is required'));
// Test NO error on advanced / save fail because no title sett.
$this
->drupalPostForm(NULL, [
'vertical_tabs_advance[cacheflush_advanced_table][0][cid]' => 'TEST',
'vertical_tabs_advance[cacheflush_advanced_table][0][table]' => 'menu',
], t('Save'));
$this
->assertNoRaw(t('Cache ID is required!'));
$this
->assertNoRaw(t('Service is required'));
$this
->assertRaw(t('Title field is required.'));
}