You are here

public function LinkitProfileUICRUDTestCase::testCreateProfile in Linkit 7.3

Create a profile.

File

test/linkit_profile.test, line 40
Tests for Linkit module.

Class

LinkitProfileUICRUDTestCase
Tests Linkit profile UI CRUD.

Code

public function testCreateProfile() {

  // Create a user and login.
  $this->account = $this
    ->drupalCreateUser($this->admin_permissions);
  $this
    ->drupalLogin($this->account);

  // Save the profile.
  $this
    ->drupalPost('admin/config/content/linkit/add', $this->profile_defaults, t('Save'));
  $this
    ->assertRaw(t('!title has been created.', array(
    '!title' => $this->profile_defaults['name'],
  )), 'The new profile was created.');

  // Go to the edit page.
  $this
    ->drupalGet('admin/config/content/linkit/list/' . $this->profile_defaults['name'] . '/edit');
  $this
    ->assertResponse(200);

  // Test that the given values are saved.
  foreach ($this->profile_defaults as $form_key => $value) {
    $this
      ->assertFieldByName($form_key, $value);
  }
}