public function ArticleCreationTest::testModerationWorkflow in Thunder 8.2
Same name and namespace in other branches
- 8.5 tests/src/FunctionalJavascript/ArticleCreationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ArticleCreationTest::testModerationWorkflow()
- 8.3 tests/src/FunctionalJavascript/ArticleCreationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ArticleCreationTest::testModerationWorkflow()
- 8.4 tests/src/FunctionalJavascript/ArticleCreationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ArticleCreationTest::testModerationWorkflow()
- 6.2.x tests/src/FunctionalJavascript/ArticleCreationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ArticleCreationTest::testModerationWorkflow()
- 6.0.x tests/src/FunctionalJavascript/ArticleCreationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ArticleCreationTest::testModerationWorkflow()
- 6.1.x tests/src/FunctionalJavascript/ArticleCreationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ArticleCreationTest::testModerationWorkflow()
Tests draft creation and that reverting to the default revision works.
File
- tests/
src/ FunctionalJavascript/ ArticleCreationTest.php, line 146
Class
- ArticleCreationTest
- Tests the article creation.
Namespace
Drupal\Tests\thunder\FunctionalJavascriptCode
public function testModerationWorkflow() {
$this
->articleFillNew([
'field_channel' => 1,
'title[0][value]' => 'Test workflow article',
'field_seo_title[0][value]' => 'Massive gaining seo traffic text',
]);
$this
->setModerationState('published');
$this
->clickSave();
$this
->assertPageTitle('Massive gaining seo traffic text');
$node = $this
->getNodeByTitle('Test workflow article');
$this
->drupalGet($node
->toUrl('edit-form'));
$this
->setFieldValues($this
->getSession()
->getPage(), [
'title[0][value]' => 'Test workflow article in draft',
'field_seo_title[0][value]' => 'Massive gaining even more seo traffic text',
]);
$this
->setModerationState('draft');
$this
->clickSave();
$this
->drupalGet($node
->toUrl('edit-form'));
$this
->setFieldValues($this
->getSession()
->getPage(), [
'title[0][value]' => 'Test workflow article in draft 2',
'field_seo_title[0][value]' => 'Massive gaining even more and more seo traffic text',
]);
$this
->setModerationState('draft');
$this
->clickSave();
$this
->assertPageTitle('Massive gaining even more and more seo traffic text');
/** @var \Drupal\content_moderation\ModerationInformationInterface $moderation_info */
$moderation_info = \Drupal::service('content_moderation.moderation_information');
$revert_url = Url::fromRoute('node.revision_revert_default_confirm', [
'node' => $node
->id(),
'node_revision' => $moderation_info
->getLatestRevisionId('node', $node
->id()),
]);
$this
->drupalPostForm($revert_url, [], $this
->t('Revert'));
$this
->drupalGet($node
->toUrl());
$this
->assertPageTitle('Massive gaining seo traffic text');
$this
->drupalGet($node
->toUrl('edit-form'));
$this
->assertSession()
->fieldValueEquals('field_seo_title[0][value]', 'Massive gaining seo traffic text');
}