View source
<?php
namespace Drupal\tmgmt_extension_suit\Tests;
class CheckEntityChangesTest extends TmgmtExtensionSuitTestBase {
public function testTrackTranslatableEntityChanges() {
$this
->requestTranslation([
1,
], 'fr', 1);
$oldHash = $this
->getNodeHash(1, 1);
$this
->drupalPostForm("node/1/edit", [], t('Save'));
$newHash = $this
->getNodeHash(1, 1);
$this
->assertEqual($oldHash, $newHash);
$this
->assertEqual($this
->isItemAddedToQueue('tmgmt_extension_suit_upload', 1), 0);
$this
->drupalPostForm("node/1/edit", [
'title[0][value]' => 'New node test title',
], t('Save'));
$newHash = $this
->getNodeHash(1, 1);
$this
->assertNotEqual($oldHash, $newHash);
$this
->assertEqual($this
->isItemAddedToQueue('tmgmt_extension_suit_upload', 1), 1);
}
public function testDoNotTrackTranslatableEntityChanges() {
$this
->requestTranslation([
1,
], 'fr', 1);
$this
->drupalPostForm('admin/tmgmt/extension-settings', [
'do_track_changes' => FALSE,
], t('Save configuration'));
$oldHash = $this
->getNodeHash(1, 1);
$this
->drupalPostForm("node/1/edit", [], t('Save'));
$newHash = $this
->getNodeHash(1, 1);
$this
->assertEqual($oldHash, $newHash);
$this
->assertEqual($this
->isItemAddedToQueue('tmgmt_extension_suit_upload', 1), 0);
$this
->drupalPostForm("node/1/edit", [
'title[0][value]' => 'New node test title',
], t('Save'));
$newHash = $this
->getNodeHash(1, 1);
$this
->assertEqual($oldHash, $newHash);
$this
->assertEqual($this
->isItemAddedToQueue('tmgmt_extension_suit_upload', 1), 0);
}
}