colectomy.test in Colectomy 7
File
tests/colectomy.test
View source
<?php
class ColectomyTestCase extends DrupalWebTestCase {
protected $privileged_user;
public static function getInfo() {
return array(
'name' => 'Colectomy',
'description' => 'Ensures the labels of form fields appear without colons.',
'group' => 'Colectomy',
);
}
public function setUp() {
parent::setUp(array(
'colectomy',
));
$this->admin_user = $this
->drupalCreateUser(array(
'use text format full_html',
'access administration pages',
'administer content types',
'administer nodes',
'bypass node access',
));
$this
->drupalLogin($this->admin_user);
}
public function testColectomyBodyNoColon() {
$edit = array(
'fields[body][label]' => 'abovec',
);
$this
->drupalPost('admin/structure/types/manage/article/display', $edit, t('Save'));
$edit = array();
$edit['title'] = $this
->randomName(8);
$edit["body[und][0][value]"] = $this
->randomName(16);
$this
->drupalPost('node/add/article', $edit, t('Save'));
$this
->assertText('Body ', 'Body label found');
}
public function testColectomyBodyWithColon() {
$edit = array(
'fields[body][label]' => 'above',
);
$this
->drupalPost('admin/structure/types/manage/article/display', $edit, t('Save'));
$edit = array();
$edit['title'] = $this
->randomName(8);
$edit["body[und][0][value]"] = $this
->randomName(16);
$this
->drupalPost('node/add/article', $edit, t('Save'));
$this
->assertText('Body:', 'Body label found');
}
}