File
-
./
exif_functionaltests.php, line 144
Class
- ExifFunctionalTestCase
- Base class for functional tests for this module.
Code
public function setUp() {
// Enable any modules required for the test.
parent::setUp($this->initModules());
// Types:
// * image/Image
// * taxonomy_term_reference/Term reference
// * text/Text
// Widgets
// * exif_readonly/metadata from image
// * image_image/Image
// Create a "photo" content type.
$settings = array(
'type' => 'photo',
'name' => 'Photography',
'base' => 'node_content',
'description' => 'show a photo and the metadata',
'help' => '',
'title_label' => 'Title',
'body_label' => 'Body',
'has_title' => 1,
'has_body' => 0,
);
$type = $this->drupalCreateContentType($settings);
$this->privileged_user = $this->drupalCreateUser(array(
'administer image metadata',
'administer content types',
'administer nodes',
'administer fields',
'administer taxonomy',
'create photo content',
'edit any photo content',
));
$this->assertNotEqual(FALSE, $this->privileged_user, 'user created.', 'Exif');
$this->drupalLogin($this->privileged_user);
$this->addExistingFieldToContentType($type, 'photo', 'image', 'image_image');
$this->addNewFieldToContentType($type, 'model', 'exif_model', 'taxonomy_term_reference', 'exif_readonly');
$this->addNewFieldToContentType($type, 'keywords', 'iptc_keywords', 'taxonomy_term_reference', 'exif_readonly', array(), array(
'field[cardinality]' => -1,
));
$this->addNewFieldToContentType($type, 'usercomment', 'exif_usercomment', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'latitude', 'gps_gpslatitude', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'longitude', 'gps_gpslongitude', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'latituderef', 'gps_gpslatituderef', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'longituderef', 'gps_gpslongituderef', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'artist', 'ifd0_artist', 'taxonomy_term_reference', 'exif_readonly');
$this->addNewFieldToContentType($type, 'title', 'ifd0_title', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'flash', 'exif_flash', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'date', 'exif_datetime', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'DateObject', 'ifd0_datetime', 'datetime', 'exif_readonly');
$this->addNewFieldToContentType($type, 'fileDate', 'exif_filedatetime', 'text', 'exif_readonly');
$this->addNewFieldToContentType($type, 'fileDateObject', 'ifd0_filedatetime', 'datetime', 'exif_readonly');
$this->activateMetadataOnObjectTypes(array(
$type->type,
));
$this->drupalGet("admin/structure/types/manage/photo/fields");
$this->drupalGet("node/add");
$this->assertResponse(200, t('User is allowed to add content types.'), 'Exif');
}