You are here

public function OrganizationUiTest::testOrganizationRevisions in CRM Core 8

Same name and namespace in other branches
  1. 8.2 modules/crm_core_contact/src/Tests/OrganizationUiTest.php \Drupal\crm_core_contact\Tests\OrganizationUiTest::testOrganizationRevisions()

Test organization revisions.

File

modules/crm_core_contact/src/Tests/OrganizationUiTest.php, line 260

Class

OrganizationUiTest
Tests the UI for Organization CRUD operations.

Namespace

Drupal\crm_core_contact\Tests

Code

public function testOrganizationRevisions() {
  $user = $this
    ->drupalCreateUser([
    'administer crm_core_organization entities',
    'view all crm_core_organization revisions',
  ]);
  $this
    ->drupalLogin($user);
  $organization = [
    'name[0][value]' => 'rev',
  ];
  $this
    ->drupalPostForm('crm-core/organization/add/supplier', $organization, 'Save Supplier');
  $organization_1 = [
    'name[0][value]' => 'rev1',
  ];
  $this
    ->drupalPostForm('crm-core/organization/1/edit', $organization_1, 'Save Supplier');
  $organization_2 = [
    'name[0][value]' => 'rev2',
  ];
  $this
    ->drupalPostForm('crm-core/organization/1/edit', $organization_2, 'Save Supplier');
  $this
    ->clickLink('Revisions');
  $this
    ->assertLinkByHref('crm-core/organization/1');
  $this
    ->assertLinkByHref('crm-core/organization/1/revisions/1/view');
  $this
    ->assertLinkByHref('crm-core/organization/1/revisions/2/view');
  $this
    ->drupalGet('crm-core/organization/1/revisions/1/view');
  $this
    ->assertText('rev');
  $this
    ->drupalGet('crm-core/organization/1/revisions/2/view');
  $this
    ->assertText('rev1');
}