public function CertificateTestCase::testCertificateUnset in Certificate 8.3
Same name and namespace in other branches
- 7.3 certificate.test \CertificateTestCase::testCertificateUnset()
Test removing a certificate mapping.
File
- ./
certificate.test, line 96 - certificate.test
Class
- CertificateTestCase
- Tests for Certificate.
Code
public function testCertificateUnset() {
$this
->drupalLogin($this->admin_user);
$activity_node = $this
->drupalCreateNode(array(
'type' => $this->contentType->type,
));
$values1 = array(
'title' => 'Cert 1',
'name' => 'cert_1',
'orientation' => 'portrait',
'certificate_body' => array(
LANGUAGE_NONE => array(
array(
'value' => 'My Certificate Body 1',
),
),
),
'type' => 'certificate',
);
$certificate1 = entity_create('certificate', $values1);
$certificate1
->save();
// Add mapping.
$this
->drupalGet("node/{$activity_node->nid}/edit");
$this
->drupalPost(NULL, array(
'certificate[map][manual][manual]' => 'cert_1',
), t('Save'));
$this
->drupalGet("node/{$activity_node->nid}/edit");
$this
->assertOptionSelected('edit-certificate-map-manual-manual', 'cert_1', 'Certificate mapping set.');
// Remove mapping.
$this
->drupalPost(NULL, array(
'certificate[map][manual][manual]' => '',
), t('Save'));
$this
->drupalGet("node/{$activity_node->nid}/edit");
$this
->assertOptionSelected('edit-certificate-map-manual-manual', '', 'Certificate mapping removed.');
}