You are here

public function MultipleValuesWidgetTest::testMultipleEntityCreate in Inline Entity Form 7

Tests create access on IEF Multiple content type.

File

tests/multiple_values_widget.test, line 482

Class

MultipleValuesWidgetTest
IEF multiple values field widget tests.

Code

public function testMultipleEntityCreate() {
  $user = $this
    ->drupalCreateUser(array(
    'create ief_test_multiple content',
  ));
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('node/add/ief-test-multiple');
  $this
    ->assertNoFieldByName('field_all_bundles[und][actions][bundle]', NULL, 'Bundle select is not shown when only one bundle is available.');
  $this
    ->assertNoFieldByName('field_multiple_nodes[und][form][title]', NULL);
  $user = $this
    ->drupalCreateUser(array(
    'create ief_test_multiple content',
    'create ief_reference_type content',
  ));
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('node/add/ief-test-multiple');
  $this
    ->assertFieldByName('field_all_bundles[und][actions][bundle]', NULL, 'Bundle select is shown when more than one bundle is available.');
  $this
    ->assertTrue((bool) $this
    ->xpath('//select[@id="edit-field-all-bundles-und-actions-bundle"]//option[@value="ief_reference_type"]'), 'IEF Reference type is available');
  $this
    ->assertTrue((bool) $this
    ->xpath('//select[@id="edit-field-all-bundles-und-actions-bundle"]//option[@value="ief_test_multiple"]'), 'IEF test multiple is available');
  $this
    ->assertFieldByName('field_multiple_nodes[und][form][title]');
}