form_options_attributes.test in Form Options Attributes 7
Tests for Form Options Attributes module
File
tests/form_options_attributes.testView source
<?php
/**
* @file
* Tests for Form Options Attributes module
*/
class FormOptionsAttributesSelectTestCase extends DrupalWebTestCase {
public function setUp() {
parent::setUp('form_options_attributes', 'form_options_attributes_test');
}
public static function getInfo() {
return array(
'name' => 'Element tests',
'description' => 'Tests form options attributes with the select, radios, and checkboxes element.',
'group' => 'Form Options Attributes',
);
}
public function testSelect() {
// Test a standard select element
$this
->drupalGet('form-options-attributes-test');
$this
->assertRaw('<option value="AL" class="southeast" data-bbq-meat="pork">Alabama</option>', t('Standard select element: class and data attributes found.'));
}
public function testOptGroupSelect() {
// Test an optgroup select element
$this
->drupalGet('form-options-attributes-test-optgroup');
$this
->assertRaw('<option value="AL" class="southeast" data-bbq-meat="pork">Alabama</option>', t('Select element with optgroup: class and data attributes found.'));
}
public function testRadios() {
// Test a radios element
$this
->drupalGet('form-options-attributes-test');
$this
->assertRaw('<input class="southeast form-radio" data-bbq-meat="pork" type="radio" id="edit-states-radio-al" name="states_radio" value="AL" />', t('Radios element: class and data attributes found.'));
}
public function testCheckboxes() {
// Test a checkboxes element
$this
->drupalGet('form-options-attributes-test');
$this
->assertRaw('<input class="southeast form-checkbox" data-bbq-meat="pork" type="checkbox" id="edit-states-checkboxes-al" name="states_checkboxes[AL]" value="AL" />', t('Checkboxes element: class and data attributes found.'));
}
}
Classes
Name | Description |
---|---|
FormOptionsAttributesSelectTestCase | @file Tests for Form Options Attributes module |