You are here

public function SortableviewsAccessTest::testAccess in Sortableviews 8

Tests the access method.

@covers ::access

@dataProvider dataProvider

File

tests/src/Unit/Access/SortableviewsAccessTest.php, line 99

Class

SortableviewsAccessTest
@coversDefaultClass \Drupal\sortableviews\Access\SortableviewsAccess @group sortableviews

Namespace

Drupal\Tests\sortableviews\Unit\Access

Code

public function testAccess(Request $request, $is_valid) {
  $result = $this->sortableViewsAccess
    ->access($request, $this->account);
  if ($is_valid) {
    $this
      ->assertTrue($result instanceof AccessResultAllowed);
    $this
      ->assertEquals($request
      ->get('entity_type'), 'some_entity');
    $this
      ->assertEquals($request
      ->get('weight_field'), 'some_field');
  }
  else {
    $this
      ->assertTrue($result instanceof AccessResultForbidden);
  }
}