LatestRevisionCheck example

/** @var \Drupal\content_moderation\ModerationInformation $mod_info */
    $mod_info = $this->prophesize(ModerationInformation::class);
    $mod_info->hasPendingRevision($entity->reveal())->willReturn($has_pending_revision);

    $route = $this->prophesize(Route::class);

    $route->getOption('_content_moderation_entity_type')->willReturn($entity_type);

    $route_match = $this->prophesize(RouteMatch::class);
    $route_match->getParameter($entity_type)->willReturn($entity->reveal());

    $lrc = new LatestRevisionCheck($mod_info->reveal());

    /** @var \Drupal\Core\Access\AccessResult $result */
    $result = $lrc->access($route->reveal()$route_match->reveal()$account->reveal());

    $this->assertInstanceOf($result_class$result);

  }

  /** * Data provider for testLastAccessPermissions(). */
  
Home | Imprint | This part of the site doesn't use cookies.