public function FppPermissionsTest::testAdminPermission in Fieldable Panels Panes (FPP) 7
Confirm that the 'admin' permission works correctly.
File
- tests/
fpp.permissions.test, line 28 - Tests for the Fieldable Panels Panes module to ensure the permissions work.
Class
- FppPermissionsTest
- Tests for the Fieldable Panels Panes module to ensure the permissions work.
Code
public function testAdminPermission() {
// Create a user with the admin permission.
$this->adminUser = $this
->createAdminUser();
$this
->drupalLogin($this->adminUser);
// Load the admin page, just to have a point of reference.
$this
->drupalGet('admin/structure/fieldable-panels-panes');
$this
->assertResponse(200, 'Loaded the main FPP admin page.');
$this
->drupalGet('admin/structure/fieldable-panels-panes/add');
$this
->assertResponse(200, 'Loaded the Add FPP admin page.');
$this
->drupalGet('admin/structure/fieldable-panels-panes/import');
$this
->assertResponse(403, 'Unable to load the Import FPP page, by default only user 1 can do that.');
// Test the default FPP type.
$this
->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/list');
$this
->assertResponse(200, 'Loaded the List page for the default FPP type.');
$this
->assertText(t('There are currently no entities of this type.'));
$this
->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/edit');
$this
->assertResponse(200, 'Loaded the Edit page for the default FPP type.');
$this
->assertFieldByName('title');
$this
->assertFieldByName('description');
$this
->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/add');
$this
->assertResponse(200, 'Loaded the Add page for the default FPP type.');
$this
->assertFieldByName('title');
$this
->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/delete');
$this
->assertResponse(200, 'Loaded the Delete page for the default FPP type.');
$this
->assertText(t('Are you sure you want to delete'));
$this
->assertText(t('This action will permanently remove this item from your database.'));
return;
$this
->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/export');
$this
->assertResponse(200, 'Loaded the Export page for the default FPP type.');
$this
->assertFieldByName('code');
$this
->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/fields');
$this
->assertResponse(200, 'Loaded the Manage Fields page for the default FPP type.');
$this
->assertText(t('The displayed title of the entity.'));
$this
->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/display');
$this
->assertResponse(200, 'Loaded the Manage Display page for the default FPP type.');
$this
->assertText(t('Use custom display settings for the following view modes'));
// These two legacy paths should redirect to the correct paths.
$this
->drupalGet('admin/structure/fieldable-panels-panes/manage/' . $this->bundle . '/fields');
$this
->assertResponse(200);
$this
->assertEqual($this
->getUrl(), url('admin/structure/fieldable-panels-panes/' . $this->bundle . '/fields', array(
'absolute' => TRUE,
)));
$this
->drupalGet('admin/structure/fieldable-panels-panes/manage/' . $this->bundle . '/display');
$this
->assertResponse(200);
$this
->assertEqual($this
->getUrl(), url('admin/structure/fieldable-panels-panes/' . $this->bundle . '/display', array(
'absolute' => TRUE,
)));
}