public function SearchByPageAttachCCKTest::setUpTypes in Search by Page 6
Sets up CCK fields for content types.
Overrides SearchByPageAttachUploadsTest::setUpTypes
4 calls to SearchByPageAttachCCKTest::setUpTypes()
- SearchbyPageAttachCCK2Test::setUp in tests/
search_by_page.test - Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
- SearchByPageAttachCCKTest::setUp in tests/
search_by_page.test - Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
- SearchbyPageAttachNotReadable::setUp in tests/
search_by_page.test - Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
- SearchbyPageAttachReindexTest::setUp in tests/
search_by_page.test - Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
File
- tests/
search_by_page.test, line 2449 - Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com
Class
- SearchByPageAttachCCKTest
- Functionality test 1 for Search by Page Attachments with CCK module.
Code
public function setUpTypes() {
// Reset CCK info to make sure nothing is cached.
_content_type_info(TRUE);
// Use functions to attach field to content -- too complex in UI...
module_load_include('inc', 'content', 'includes/content.crud');
// Figure out what the FileField field type is (not stable module)
$info = filefield_field_info();
$keys = array_keys($info);
$fieldtype = $keys[0];
$this
->assertTrue(1, "Field name is " . $fieldtype);
// Figure out what the FileField widget type is (not stable module)
$info = filefield_widget_info();
$keys = array_keys($info);
$widgettype = $keys[0];
$this
->assertTrue(1, "Widget name is " . $widgettype);
$info = _content_field_types($fieldtype);
$this
->assertFalse(empty($info), "Field type for filefield exists");
// Note: depending on the FileField version, the description and list
// settings might be on the field or on the widget. Sigh.
$field = array(
'field_name' => 'field_myfile',
'type_name' => 'sbp_indexed',
'type' => $fieldtype,
'widget_type' => $widgettype,
'field_settings' => array(
'description_field' => TRUE,
'list_field' => TRUE,
'file_extensions' => 'txt not',
),
'widget_settings' => array(
'description_field' => TRUE,
'list_field' => TRUE,
'file_extensions' => 'txt not',
),
'label' => 'A file',
'multiple' => 5,
);
content_field_instance_create($field);
// Verify field was created.
$field = array(
'field_name' => 'field_myfile',
'type_name' => 'sbp_indexed',
);
$info = content_field_instance_read($field);
$this
->assertFalse(empty($info), 'File field is attached to content type sbp_indexed');
$field = array(
'field_name' => 'field_myfile',
'type_name' => 'sbp_hidden',
);
content_field_instance_create($field);
$info = content_field_instance_read($field);
$this
->assertFalse(empty($info), 'File field is attached to content type sbp_hidden');
}