protected function PageManagerAdminTest::doTestSelectionCriteria in Page Manager 8
Tests selection criteria step on both add and edit wizard.
Parameters
string $path: The path this step is supposed to be at.
bool|TRUE $redirect: Whether or not to redirect to the path.
2 calls to PageManagerAdminTest::doTestSelectionCriteria()
- PageManagerAdminTest::doTestAddPage in page_manager_ui/
src/ Tests/ PageManagerAdminTest.php - Tests adding a page.
- PageManagerAdminTest::testAdmin in page_manager_ui/
src/ Tests/ PageManagerAdminTest.php - Tests the Page Manager admin UI.
File
- page_manager_ui/
src/ Tests/ PageManagerAdminTest.php, line 200 - Contains \Drupal\page_manager_ui\Tests\PageManagerAdminTest.
Class
- PageManagerAdminTest
- Tests the admin UI for page entities.
Namespace
Drupal\page_manager_ui\TestsCode
protected function doTestSelectionCriteria($path = 'admin/structure/page_manager/manage/foo/page_variant__foo-http_status_code-0__selection', $redirect = TRUE) {
if ($this
->getUrl() !== $path && $redirect) {
$this
->drupalGet($path);
}
$this
->assertRaw('No required conditions have been configured.');
// Configure a new condition.
$edit = [
'conditions' => 'user_role',
];
$this
->drupalPostForm(NULL, $edit, 'Add Condition');
$this
->assertTitle('Add new selection condition | Drupal');
$edit = [
'roles[authenticated]' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, 'Save');
$this
->assertRaw('The user is a member of Authenticated user');
// Make sure we're still on the add wizard (not the edit wizard).
$this
->assertUrl($path);
// Edit the condition.
$this
->clickLink('Edit');
$this
->assertTitle('Edit selection condition | Drupal');
$edit = [
'roles[anonymous]' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, 'Save');
$this
->assertRaw('The user is a member of Anonymous user, Authenticated user');
$this
->assertUrl($path);
// Delete the condition.
$this
->clickLink('Delete');
$this
->assertTitle('Are you sure you want to delete the user_role condition? | Drupal');
$this
->drupalPostForm(NULL, [], 'Delete');
$this
->assertRaw('No required conditions have been configured.');
$this
->assertUrl($path);
}