3 namespace Drupal\diff\Tests;
4 use Drupal\Tests\diff\Functional\CoreVersionUiTestTrait;
7 * Tests field visibility when using a custom view mode.
11 class DiffViewModeTest extends DiffTestBase {
13 use CoreVersionUiTestTrait;
20 public static $modules = ['field_ui'];
23 * Tests field visibility using a cutom view mode.
25 public function testViewMode() {
26 $this->drupalLogin($this->rootUser);
29 $node = $this->drupalCreateNode([
31 'title' => 'Sample node',
37 // Edit the article and change the email.
39 'body[0][value]' => 'Fighters',
42 $this->drupalPostNodeForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
44 // Set the Body field to hidden in the diff view mode.
46 'fields[body][region]' => 'hidden',
48 $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save'));
50 'fields[body][region]' => 'hidden',
52 $this->drupalPostForm('admin/structure/types/manage/article/display/teaser', $edit, t('Save'));
54 // Check the difference between the last two revisions.
55 $this->drupalGet('node/' . $node->id() . '/revisions');
56 $this->drupalPostForm(NULL, [], t('Compare selected revisions'));
57 $this->assertNoText('Body');
58 $this->assertNoText('Foo');
59 $this->assertNoText('Fighters');