public function MobileToolsDeviceGroupTestCase::testDefaultDeviceGroupRevert in Mobile Tools 7.3
Tests that the default device group can be modified and then reverted.
File
- ./
mobile_tools.test, line 196 - Tests for mobile tools
Class
Code
public function testDefaultDeviceGroupRevert() {
$this
->drupalLogin($this->admin_user);
// Test editing default device group
// Get edit device group form
$this
->drupalGet($this->editUrl . '/mobile');
$this
->assertFieldByName('title', 'Mobile', t('Found title field.'));
$this
->assertFieldByName('dgid', 'mobile', t('Found machine-name field.'));
$this
->assertFieldByName('purl_modifier', 'mobile', t('Found PURL modifier field.'));
$this
->assertOptionSelected('edit-theme', '0', t('Found theme option.'));
$this
->assertFieldByName('description', 'Sample device group.', t('Found description field.'));
$form = $this->device_group;
$form['title'] = 'Mobile Overridden';
unset($form['dgid']);
// Submit modified default device group
$this
->drupalPost($this->editUrl . '/mobile', $form, t('Save device group'));
$this
->assertText('Mobile Overridden');
$this
->assertLinkByHref($this->editUrl . '/mobile', 0, t('Edit link found.'));
$this
->assertLinkByHref($this->deleteUrl . '/mobile', 0, t('Revert link found.'));
// Test reverting device group
// Get revert device group form
$this
->drupalGet($this->deleteUrl . '/mobile');
$this
->assertText('Are you sure you want to revert the device group ' . $form['title']);
$form = array(
'confirm' => 1,
);
// Confirm reverting default device group
$this
->drupalPost($this->deleteUrl . '/mobile', $form, t('Revert'));
$this
->assertText('Device group mobile has been reverted.');
$this
->assertText('Mobile');
$this
->assertNoText('Mobile Overridden');
}