public function WebformOptionsLimitAccessTest::testAccess in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_options_limit/tests/src/Functional/WebformOptionsLimitAccessTest.php \Drupal\Tests\webform_options_limit\Functional\WebformOptionsLimitAccessTest::testAccess()
Test options limit access.
File
- modules/
webform_options_limit/ tests/ src/ Functional/ WebformOptionsLimitAccessTest.php, line 27
Class
- WebformOptionsLimitAccessTest
- Webform options limit test.
Namespace
Drupal\Tests\webform_options_limit\FunctionalCode
public function testAccess() {
$webform = Webform::load('test_handler_options_limit');
$this
->postSubmission($webform);
$this
->postSubmission($webform);
$this
->postSubmission($webform);
// Check that no one can access the options summary page.
$this
->drupalGet('/admin/structure/webform/manage/test_handler_options_limit/results/options-limit');
$this
->assertResponse(403);
// Check that user with 'view any webform submission' permission can access
// the options summary page.
$this
->drupalLogin($this
->createUser([
'view any webform submission',
]));
$this
->drupalGet('/admin/structure/webform/manage/test_handler_options_limit/results/options-limit');
$this
->assertResponse(200);
// Check that options summary page is only available to webforms with
// options limit handler.
$this
->drupalGet('/admin/structure/webform/manage/contact/results/options-limit');
$this
->assertResponse(403);
}