You are here

function AttributeCrudTest::testAdd in Linkit 8.4

Test adding an attribute to a profile.

File

src/Tests/AttributeCrudTest.php, line 62
Contains \Drupal\linkit\Tests\AttributeCrudTest.

Class

AttributeCrudTest
Tests adding, listing and deleting attributes on a profile.

Namespace

Drupal\linkit\Tests

Code

function testAdd() {
  $this
    ->drupalGet(Url::fromRoute('linkit.attribute.add', [
    'linkit_profile' => $this->linkitProfile
      ->id(),
  ]));
  $this
    ->assertEqual(count($this->manager
    ->getDefinitions()), count($this
    ->xpath('//input[@type="radio"]')), 'All attributes are available.');
  $edit = array();
  $edit['plugin'] = 'dummy_attribute';
  $this
    ->drupalPostForm(NULL, $edit, t('Save and continue'));
  $this
    ->assertUrl(Url::fromRoute('linkit.attributes', [
    'linkit_profile' => $this->linkitProfile
      ->id(),
  ]));
  $this
    ->assertEqual(1, count($this
    ->xpath('//table/tbody/tr')), 'Attribute added.');
  $this
    ->assertNoText(t('No attributes added.'));
}