WebformOptionsLimitAccessTest.php in Webform 8.5
File
modules/webform_options_limit/tests/src/Functional/WebformOptionsLimitAccessTest.php
View source
<?php
namespace Drupal\Tests\webform_options_limit\Functional;
use Drupal\webform\Entity\Webform;
use Drupal\Tests\webform\Functional\WebformBrowserTestBase;
class WebformOptionsLimitAccessTest extends WebformBrowserTestBase {
public static $modules = [
'webform',
'webform_options_limit',
'webform_options_limit_test',
];
public function testAccess() {
$webform = Webform::load('test_handler_options_limit');
$this
->postSubmission($webform);
$this
->postSubmission($webform);
$this
->postSubmission($webform);
$this
->drupalGet('/admin/structure/webform/manage/test_handler_options_limit/results/options-limit');
$this
->assertResponse(403);
$this
->drupalLogin($this
->createUser([
'view any webform submission',
]));
$this
->drupalGet('/admin/structure/webform/manage/test_handler_options_limit/results/options-limit');
$this
->assertResponse(200);
$this
->drupalGet('/admin/structure/webform/manage/contact/results/options-limit');
$this
->assertResponse(403);
}
}