function CertificateTestCase::testCertificateTemplates in Certificate 3.x
Same name and namespace in other branches
- 8.3 certificate.test \CertificateTestCase::testCertificateTemplates()
- 7.3 certificate.test \CertificateTestCase::testCertificateTemplates()
- 7.2 certificate.test \CertificateTestCase::testCertificateTemplates()
Test certicificate templating and tokens.
File
- ./
certificate.test, line 77 - certificate.test
Class
- CertificateTestCase
- Tests for Certificate.
Code
function testCertificateTemplates() {
$account = $this
->drupalCreateUser(array(
'administer certificates',
));
$node = $this
->drupalCreateNode(array(
'title' => 'My test certifiable type',
));
$certificate = $this
->drupalCreateNode(array(
'type' => 'certificate',
'body' => array(
LANGUAGE_NONE => array(
array(
'value' => '[node:title][user:name]',
),
),
),
));
$firstletter = $account->name[0];
// Map the first letter of the user's name to the certificate.
certificate_update_node_mappings($node->nid, array(
'firstletter' => array(
$firstletter => $certificate->nid,
),
));
$this
->drupalLogin($account);
$this
->drupalGet("node/{$node->nid}/certificate?preview");
$this
->assertText('My test certifiable type', "Saw node title.");
$this
->assertText($account->name, "Saw user name.");
}