public function PropertiesTemplateTestCase::testExportAsTemplate in Dynamic properties 7
Test for exporting a content as template.
File
- properties_template/
properties_template.test, line 214 - Contains tests for the properties_template.module
Class
- PropertiesTemplateTestCase
- Tests for fields integration.
Code
public function testExportAsTemplate() {
$this
->loginAdmin();
$this
->createProperties();
$this
->createField();
$node = $this
->createEntity();
// Click edit
$this
->clickLink(t('Edit'));
// Export as template
$this
->clickLink(t('Export as template'));
// Loop over the categories and check if labels occur in the new page
foreach ($this->categories as $category) {
$this
->assertText($category->label);
}
$template_name = drupal_strtolower($this
->randomName(8));
$template_label = $this
->randomName(20);
// submit template form
$template_form = array(
'name' => $template_name,
'label' => $template_label,
);
$this
->drupalPost(NULL, $template_form, t('Save'));
// look if the new generated template occurs in the list
$this
->drupalGet('admin/config/content/properties/templates');
$this
->assertText($template_name);
$this
->assertText($template_label);
// look if the template was stored in the db
$template_object = properties_template_load($template_name);
$this
->assertEqual($template_object->label, $template_label);
}