public function CertificateTestCase::testCertificateAccess in Certificate 7.2
Same name and namespace in other branches
- 8.3 certificate.test \CertificateTestCase::testCertificateAccess()
- 6.2 certificate.test \CertificateTestCase::testCertificateAccess()
- 7.3 certificate.test \CertificateTestCase::testCertificateAccess()
- 3.x certificate.test \CertificateTestCase::testCertificateAccess()
File
- ./
certificate.test, line 29 - certificate.test
Class
- CertificateTestCase
- Tests for Certificate.
Code
public function testCertificateAccess() {
$u1 = $this
->drupalCreateUser();
// Create an activity.
$activity_node = $this
->drupalCreateNode(array(
'type' => $this->contentType->type,
));
// Check for forbidden certificate.
$result = certificate_can_access_certificate($activity_node, $u1);
$this
->assertTrue($result !== TRUE, 'User cannot access certificate.');
$this
->assertTrue($result == 'Custom access denied message.', 'Error message matched module provided message.');
// Set certificates to appear.
$GLOBALS['certificate_ok'] = TRUE;
$result = certificate_can_access_certificate($activity_node, $u1, TRUE);
$this
->assertTrue($result === TRUE, 'User can access certificate.');
}