You are here

function LinkContentCrudTest::testLinkCreateFieldAPI in Link 6

Same name and namespace in other branches
  1. 6.2 tests/link.crud.test \LinkContentCrudTest::testLinkCreateFieldAPI()

All we're doing here is creating a content type, creating a simple link field on that content type, and making sure said field exists in the database.

File

tests/link.crud.test, line 30
Basic CRUD simpletests for the link module, based off of content.crud.test in CCK.

Class

LinkContentCrudTest

Code

function testLinkCreateFieldAPI() {
  $this
    ->acquireContentTypes(1);
  $field = $this
    ->createField(array(
    'type' => 'link',
    'widget_type' => 'link',
  ), 0);
  $this
    ->assertEqual(1, 1, print_r($this->content_types, TRUE));
  $this
    ->assertEqual(1, 1, print_r($field, TRUE));
  $table_schema = drupal_get_schema();
  $this
    ->assertEqual(1, 1, print_r(array_keys($table_schema), TRUE));

  // Check the schema - the values should be in the per-type table.
  $this
    ->assertSchemaMatchesTables(array(
    'per_type' => array(
      $this->content_types[0]->type => array(
        $field['field_name'] => array(
          'url',
          'title',
          'attributes',
        ),
      ),
    ),
  ));
}