1 admin_bar.test AdminBarDynamicLinksTestCase::testNodeAdd()

Tests Add content links.

File

core/modules/admin_bar/tests/admin_bar.test, line 350
Tests for the Administration bar module.

Class

AdminBarDynamicLinksTestCase
Tests appearance, localization, and escaping of dynamic links.

Code

function testNodeAdd() {
  $this->backdropCreateContentType(array('type' => 'post', 'name' => 'Post'));

  // Verify that "Add content" does not appear for unprivileged users.
  $permissions = $this->basePermissions + array();
  $this->web_user = $this->backdropCreateUser($permissions);
  $this->backdropLogin($this->web_user);
  $this->assertNoText(t('Add content'));

  // Verify "Add content" appears below "Content" for administrative users.
  $permissions = $this->basePermissions + array(
    'access content overview',
    'create post content',
  );
  $this->admin_user = $this->backdropCreateUser($permissions);
  $this->backdropLogin($this->admin_user);
  $this->assertLinkTrailByTitle(array(
    t('Content'),
    t('Add content'),
  ));

  // Verify "Add content" appears on the top-level for regular users.
  $permissions = $this->basePermissions + array(
    'create post content',
  );
  $this->web_user = $this->backdropCreateUser($permissions);
  $this->backdropLogin($this->web_user);
  $this->assertLinkTrailByTitle(array(
    t('Add content'),
  ));
}