summaryrefslogtreecommitdiff
path: root/modules/field/field.test
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 05:24:38 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 05:24:38 +0000
commit243ecdaf523d7f93d0c82f2c5eba8f9412291d94 (patch)
treea3f10ed4b8aa65c0d1319b20619b86e3053a2794 /modules/field/field.test
parent9f7aaa2341b914d455949ac5d1044256f25a5856 (diff)
downloadbrdo-243ecdaf523d7f93d0c82f2c5eba8f9412291d94.tar.gz
brdo-243ecdaf523d7f93d0c82f2c5eba8f9412291d94.tar.bz2
#394246 by flobruit: Check to ensure that field type is specified.
Diffstat (limited to 'modules/field/field.test')
-rw-r--r--modules/field/field.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/field/field.test b/modules/field/field.test
index 12eb854c3..2dabfca5e 100644
--- a/modules/field/field.test
+++ b/modules/field/field.test
@@ -939,6 +939,26 @@ class FieldTestCase extends DrupalWebTestCase {
* Test the creation of a field.
*/
function testCreateField() {
+ // Check that field type is required.
+ try {
+ $field_definition = array(
+ 'field_name' => drupal_strtolower($this->randomName()),
+ );
+ field_create_field($field_definition);
+ $this->fail(t('Cannot create a field with no type.'));
+ } catch (FieldException $e) {
+ $this->pass(t('Cannot create a field with no type.'));
+ }
+
+ // Check that field name is required.
+ try {
+ $field_definition = array('type' => 'test_field');
+ field_create_field($field_definition);
+ $this->fail(t('Cannot create an unnamed field.'));
+ } catch (FieldException $e) {
+ $this->pass(t('Cannot create an unnamed field.'));
+ }
+
$field_definition = array(
'field_name' => drupal_strtolower($this->randomName()),
'type' => 'test_field',