public function ExifFunctionalTestCase::testCreatePhotoNodeWithImage in Exif 7
File
- ./
exif_functionaltests.php, line 199
Class
Code
public function testCreatePhotoNodeWithImage() {
$settings = array(
'type' => 'photo',
'title' => $this
->randomName(32),
);
$node = $this
->drupalCreateNode($settings);
$this
->assertNotNull($node, "node created", 'Exif');
$this
->verbose('Node created: ' . var_export($node, TRUE));
$this
->drupalGet("node/{$node->nid}/edit");
//check field settings are hidden.
$this
->assertRaw("exif.css");
//assert hidden field are present
$this
->assertField("field_iptc_keywords[und][0][tid]", "hidden field keywords is present", "Exif");
$this
->assertField("field_exif_model[und][0][tid]", "hidden field model is present", "Exif");
$this
->assertResponse(200, t('User is allowed to edit the content.'), 'Exif');
$this
->assertText(t("@title", array(
'@title' => $settings['title'],
)), "Found title in edit form", 'Exif');
$img_path = drupal_get_path('module', 'exif') . "/sample.jpg";
$this
->assertTrue(file_exists($img_path), "file {$img_path} exists.", "Exif");
$file_upload = array(
'files[field_image_und_0]' => $img_path,
);
$this
->drupalPostAJAX(NULL, $file_upload, 'field_image_und_0_upload_button');
$this
->assertResponse(200, t('photo is uploaded.'), 'Exif');
$this
->drupalGet("node/{$node->nid}/edit");
$fid = $this
->getLastFileId();
$file_uploaded_attach = array(
'field_image[und][0][fid]' => $fid,
);
$this
->drupalPost(NULL, $file_uploaded_attach, t('Save'));
$this
->assertResponse(200, t('trying to submit node.'), 'Exif');
$this
->assertNoText("The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.", t('form has been correctly submitted'), 'Exif');
$this
->drupalGet("node/{$node->nid}");
$this
->assertResponse(200, t('photography node edition is complete.'), 'Exif');
//check for label
$this
->assertText("model");
$this
->assertText("keywords");
$this
->assertText("latitude");
$this
->assertText("longitude");
$this
->assertText("comment");
$this
->assertText("artist");
$this
->assertText("title");
$this
->assertText("flash");
$this
->assertText("date");
$this
->assertText("DateObject");
$this
->assertText("fileDate");
$this
->assertText("fileDateObject");
//check for values
$this
->assertText("Canon EOS 350D DIGITAL", "model value is correct", "Exif");
$this
->assertText("annika", "keyword n°1 is correct", "Exif");
$this
->assertText("geburtstag", "keyword n°2 is correct", "Exif");
$this
->assertText("O'Brien", "keyword n°3 is correct (apostrophe in text)", "Exif");
$this
->assertText("51.2977", "latitude is correct", "Exif");
$this
->assertText("12.2206", "longitude is correct", "Exif");
$this
->assertText("ich bin ein kleiner kommentar", "comment is correct", "Exif");
$this
->assertNoText("UNICODEich bin ein kleiner kommentar", "comment is correct", "Exif");
$this
->assertText("Raphael Schär", "artist is correct", "Exif");
$this
->assertText("Der Titel", "title is correct", "Exif");
$this
->assertText("Flash fired, compulsory flash mode", "flash is correct", "Exif");
$this
->assertText("2009-01-23T08:52:43", "date (wihtout Date module) is correct", "Exif");
$this
->assertText("2009/01/23 08:52:43", "date (with Date module) is correct", "Exif");
$this
->assertText("2011-11-05T21:39:10+01:00", "file date (wihtout Date module) is correct", "Exif");
$this
->assertText("2011/11/05 21:39:10", "file date (with Date module) is correct", "Exif");
}