public function LinkitProfileUICRUDTestCase::testUpdateProfile in Linkit 7.3
Update a profile.
File
- test/
linkit_profile.test, line 63 - Tests for Linkit module.
Class
- LinkitProfileUICRUDTestCase
- Tests Linkit profile UI CRUD.
Code
public function testUpdateProfile() {
// Create a user and login.
$this->account = $this
->drupalCreateUser($this->admin_permissions);
$this
->drupalLogin($this->account);
// Create a profile.
$this
->createProfile(array(
'data' => array(
'autocomplete' => array(
'charLimit' => LINKIT_CHAR_LIMIT,
'wait' => LINKIT_WAIT,
'remoteTimeout' => LINKIT_REMOTE_TIMEOUT,
),
),
));
// Go to the edit page.
$this
->drupalGet('admin/config/content/linkit/list/' . $this->_profile->name . '/edit');
$this
->assertResponse(200);
$profile_update = array(
'admin_title' => 'Test Profile updated',
'admin_description' => 'This is a updated description for the Test Profile updated.',
'data[autocomplete][charLimit]' => 4,
'data[autocomplete][wait]' => 3500,
'data[autocomplete][remoteTimeout]' => 1000,
);
// Set some new values for the profile.
$this
->drupalPost(NULL, $profile_update, t('Save'));
// Go to the edit page again.
$this
->drupalGet('admin/config/content/linkit/list/' . $this->_profile->name . '/edit');
$this
->assertResponse(200);
// Test that the given values are saved.
foreach ($profile_update as $form_key => $value) {
$this
->assertFieldByName($form_key, $value);
}
}