public function testModeratedContentPage() { $assert_session =
$this->
assertSession();
$this->
drupalLogin($this->adminUser
);
// Use an explicit changed time to ensure the expected order in the content
// admin listing. We want these to appear in the table in the same order as
// they appear in the following code, and the 'moderated_content' view has a
// table style configuration with a default sort on the 'changed' field
// descending.
$time = \Drupal::
time()->
getRequestTime();
$excluded_nodes['published_page'
] =
$this->
drupalCreateNode(['type' => 'page', 'changed' =>
$time--, 'moderation_state' => 'published'
]);
$excluded_nodes['published_article'
] =
$this->
drupalCreateNode(['type' => 'article', 'changed' =>
$time--, 'moderation_state' => 'published'
]);
$excluded_nodes['unmoderated_type'
] =
$this->
drupalCreateNode(['type' => 'unmoderated_type', 'changed' =>
$time--
]);
$excluded_nodes['unmoderated_type'
]->
setNewRevision(TRUE
);
$excluded_nodes['unmoderated_type'
]->
isDefaultRevision(FALSE
);
$excluded_nodes['unmoderated_type'
]->changed->value =
$time--;
$excluded_nodes['unmoderated_type'
]->
save();
$nodes['published_then_draft_article'
] =
$this->
drupalCreateNode(['type' => 'article', 'changed' =>
$time--, 'moderation_state' => 'published', 'title' => 'first article - published'
]);
$nodes['published_then_draft_article'
]->
setNewRevision(TRUE
);
$nodes['published_then_draft_article'
]->
setTitle('first article - draft'
);