YamlFormSubmissionAccessTest.php in YAML Form 8
File
src/Tests/YamlFormSubmissionAccessTest.php
View source
<?php
namespace Drupal\yamlform\Tests;
class YamlFormSubmissionAccessTest extends YamlFormTestBase {
public function testAccess() {
list($yamlform, $submissions) = $this
->createYamlFormWithSubmissions();
$yamlform_id = $yamlform
->id();
$sid = $submissions[0]
->id();
$this
->drupalGet('/admin/structure/yamlform/results/manage');
$this
->assertResponse(403);
$this
->drupalGet("/admin/structure/yamlform/manage/{$yamlform_id}/results/submissions");
$this
->assertResponse(403);
$this
->drupalGet("/admin/structure/yamlform/manage/{$yamlform_id}/submission/{$sid}");
$this
->assertResponse(403);
$viewSubmissionUser = $this
->drupalCreateUser([
'access content',
'access yamlform overview',
'view any yamlform submission',
]);
$this
->drupalLogin($viewSubmissionUser);
$this
->drupalGet('/admin/structure/yamlform/results/manage');
$this
->assertResponse(200);
$this
->drupalGet("/admin/structure/yamlform/manage/{$yamlform_id}/results/submissions");
$this
->assertResponse(200);
$this
->drupalGet("/admin/structure/yamlform/manage/{$yamlform_id}/submission/{$sid}");
$this
->assertResponse(200);
}
}