// Publish the English article and check that the translation stays
// unpublished.
$this->
drupalGet('node/' .
$english_node->
id() . '/edit'
);
$this->
submitForm(['moderation_state[0][state]' => 'published'
], 'Save (this translation)'
);
$this->
assertSession()->
pageTextContains('Article English node has been updated.'
);
$english_node =
$this->
drupalGetNodeByTitle('English node', TRUE
);
$french_node =
$english_node->
getTranslation('fr'
);
$this->
assertEquals('French node',
$french_node->
label());
$this->
assertEquals('published',
$english_node->moderation_state->value
);
$this->
assertTrue($english_node->
isPublished());
$this->
assertEquals('draft',
$french_node->moderation_state->value
);
$this->
assertFalse($french_node->
isPublished());
// Create another article with its translation. This time we will publish
// the translation first.
$edit =
[ 'title[0][value]' => 'Another node',
'moderation_state[0][state]' => 'draft',
];
$this->
drupalGet('node/add/article'
);
$this->
submitForm($edit, 'Save'
);