public function EntityLegalMethodsTestCase::testMessageMethod in Entity Legal 7
Same name and namespace in other branches
- 7.2 tests/entity_legal.methods.test \EntityLegalMethodsTestCase::testMessageMethod()
Drupal message method test.
File
- tests/
entity_legal.methods.test, line 25 - Test for defined methods in Entity Legal module.
Class
- EntityLegalMethodsTestCase
- Simpletest class for acceptance methods.
Code
public function testMessageMethod() {
$document = $this
->createDocument(TRUE, TRUE, array(
'existing_users' => array(
'require_method' => 'message',
),
));
$this
->createDocumentVersion($document, TRUE);
$acceptance_message = format_string('Please accept the @title', array(
'@title' => entity_legal_document_title($document),
));
$document_uri = entity_uri(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME, $document);
$document_path = $document_uri['path'];
$account = $this
->createUserWithAcceptancePermissions($document);
$this
->drupalLogin($account);
$this
->assertText($acceptance_message, 'Document message found');
$this
->assertLinkByHref(url($document_path), 0, 'Link to document found');
$this
->clickLink(entity_legal_document_title($document));
$this
->assertFieldByName('agree', NULL, 'I agree checkbox found');
$this
->drupalPost($document_path, array(
'agree' => TRUE,
), 'Submit');
$this
->assertNoLinkByHref(url($document_path), 0, 'Link to document not found');
$this
->assertNoText($acceptance_message, 'Document message not found');
$this
->createDocumentVersion($document, TRUE);
$this
->drupalGet('');
$acceptance_message_2 = format_string('Please accept the @title', array(
'@title' => entity_legal_document_title($document),
));
$this
->assertText($acceptance_message_2, 'Document message found');
$this
->assertLinkByHref(url($document_path), 0, 'Link to document found');
}