protected function LibrariesWebTestBase::getWithPermissions in Libraries API 7.2
Retrieves a path making sure a set of permissions is required to access it.
After calling this method, a user with the given permissions is logged in and the retrieved page is loaded into the internal browser.
Parameters
array $permissions: An array of permission names to assign to user. Note that the user always has the default permissions derived from the "authenticated users" role.
string $path: Drupal path or URL to load into the internal browser.
array $options: Options to be forwarded to url().
array $headers: An array containing additional HTTP request headers, each formatted as "name: value".
Return value
string The retrieved HTML string, also available as $this->drupalGetContent().
See also
\DrupalWebTestCase::drupalGet()
\DrupalWebTestCase::drupalCreateUser()
5 calls to LibrariesWebTestBase::getWithPermissions()
- LibrariesAdminWebTest::testLibrariesReportInstalled in tests/
LibrariesAdminWebTest.test - Tests the libraries report for an installed library.
- LibrariesAdminWebTest::testLibrariesReportMissing in tests/
LibrariesAdminWebTest.test - Tests the libraries report for a missing library.
- LibrariesAdminWebTest::testLibrariesReportNotDetected in tests/
LibrariesAdminWebTest.test - Tests the libraries report for a missing library.
- LibrariesAdminWebTest::testLibrariesReportNotSupported in tests/
LibrariesAdminWebTest.test - Tests the libraries report for a missing library.
- LibrariesAdminWebTest::testLibrariesReportOverview in tests/
LibrariesAdminWebTest.test - Tests the libraries report at /admin/reports/libraries.
File
- tests/
LibrariesWebTestBase.test, line 55 - Contains LibrariesWebTestBase.
Class
- LibrariesWebTestBase
- Base class for Libraries API web tests.
Code
protected function getWithPermissions(array $permissions, $path, array $options = array(), array $headers = array()) {
$this
->drupalGet($path, $options, $headers);
$this
->assertResponse(403);
$this
->drupalLogin($this
->drupalCreateUser($permissions));
$this
->drupalGet($path, $options, $headers);
$this
->assertResponse(200);
}