3 namespace Drupal\diff\Tests;
6 * Tests field visibility when using a custom view mode.
10 class DiffViewModeTest extends DiffTestBase {
17 public static $modules = ['field_ui'];
20 * Tests field visibility using a cutom view mode.
22 public function testViewMode() {
23 $this->drupalLogin($this->rootUser);
26 $node = $this->drupalCreateNode([
28 'title' => 'Sample node',
34 // Edit the article and change the email.
36 'body[0][value]' => 'Fighters',
39 $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
41 // Set the Body field to hidden in the diff view mode.
43 'fields[body][region]' => 'hidden',
45 $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save'));
47 'fields[body][region]' => 'hidden',
49 $this->drupalPostForm('admin/structure/types/manage/article/display/teaser', $edit, t('Save'));
51 // Check the difference between the last two revisions.
52 $this->drupalGet('node/' . $node->id() . '/revisions');
53 $this->drupalPostForm(NULL, [], t('Compare selected revisions'));
54 $this->assertNoText('Body');
55 $this->assertNoText('Foo');
56 $this->assertNoText('Fighters');