You are here

public function WebformBreadcrumbBuilderTest::testBuildUserSubmissions in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Kernel/Breadcrumb/WebformBreadcrumbBuilderTest.php \Drupal\Tests\webform\Kernel\Breadcrumb\WebformBreadcrumbBuilderTest::testBuildUserSubmissions()

Test build user submissions breadcrumbs.

File

tests/src/Kernel/Breadcrumb/WebformBreadcrumbBuilderTest.php, line 419

Class

WebformBreadcrumbBuilderTest
Test webform breadcrumb builder.

Namespace

Drupal\Tests\webform\Kernel\Breadcrumb

Code

public function testBuildUserSubmissions() {

  // Check without view own access.
  $route_match = $this
    ->getMockRouteMatch('entity.webform.user.submission', [
    [
      'webform_submission',
      $this->webformSubmission,
    ],
  ]);
  $links = [
    Link::createFromRoute($this->webform
      ->label(), 'entity.webform.canonical', [
      'webform' => $this->webform
        ->id(),
    ]),
  ];
  $this
    ->assertLinks($route_match, $links);

  // Check with view own access.
  $route_match = $this
    ->getMockRouteMatch('entity.webform.user.submission', [
    [
      'webform_submission',
      $this->webformSubmissionAccess,
    ],
  ]);
  $links = [
    Link::createFromRoute($this->webform
      ->label(), 'entity.webform.canonical', [
      'webform' => $this->webform
        ->id(),
    ]),
    Link::createFromRoute('Submissions', 'entity.webform.user.submissions', [
      'webform' => $this->webform
        ->id(),
    ]),
  ];
  $this
    ->assertLinks($route_match, $links);
}