You are here

protected function LinkitTestCase::createProfile in Linkit 7.3

Helper function: Create a Linkit profile.

7 calls to LinkitTestCase::createProfile()
LinkitProfileUICRUDTestCase::testDeleteProfile in test/linkit_profile.test
Delete a profile.
LinkitProfileUICRUDTestCase::testLoadAllProfiles in test/linkit_profile.test
Load all profiles.
LinkitProfileUICRUDTestCase::testLoadProfile in test/linkit_profile.test
Load a profile that exists.
LinkitProfileUICRUDTestCase::testUpdateProfile in test/linkit_profile.test
Update a profile.
LinkitsearchPluginNodeTestCase::setUp in test/linkit_search_plugin_node.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

test/linkit.test, line 45
Tests for Linkit module.

Class

LinkitTestCase

Code

protected function createProfile($extra = array()) {
  ctools_include('export');
  $profile = ctools_export_crud_new('linkit_profiles');
  $profile->name = isset($extra['name']) ? $extra['name'] : 'test_profile';
  $profile->admin_title = isset($extra['admin_title']) ? $extra['admin_title'] : 'Test Profile';
  $profile->admin_description = isset($extra['admin_description']) ? $extra['admin_description'] : 'This is a description for the Test Profile.';
  $profile->data = array();
  if (isset($extra['data'])) {
    $profile->data += $extra['data'];
  }
  if (empty($profile->data['profile_type'])) {
    $profile->profile_type = LINKIT_PROFILE_TYPE_EDITOR;
  }
  if (!isset($profile->data['insert_plugin']) && $profile->profile_type == LINKIT_PROFILE_TYPE_FIELD) {
    $profile->data['insert_plugin'] = array(
      'plugin' => 'raw_url',
      'url_method' => LINKIT_URL_METHOD_RAW,
    );
  }

  // Save the profile.
  ctools_export_crud_save('linkit_profiles', $profile);

  // Load and return the saved profile.
  $this->_profile = linkit_profile_load($profile->name);
}