public function ConfigEntityRevisionsRevertFormBaseTest::buildFormProducesExpectedRenderArray in Config Entity Revisions 8.2
Same name and namespace in other branches
- 8 tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php \Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormBaseTest::buildFormProducesExpectedRenderArray()
- 1.x tests/src/Unit/ConfigEntityRevisionsRevertFormBaseTest.php \Drupal\Tests\config_entity_revisions\Unit\ConfigEntityRevisionsRevertFormBaseTest::buildFormProducesExpectedRenderArray()
Validate the built render array. Should be just what the parent provides.
@test
File
- tests/
src/ Unit/ ConfigEntityRevisionsRevertFormBaseTest.php, line 300
Class
- ConfigEntityRevisionsRevertFormBaseTest
- Class ConfigEntityRevisionsRevertFormBaseTest.
Namespace
Drupal\Tests\config_entity_revisions\UnitCode
public function buildFormProducesExpectedRenderArray() {
// Start with a revision older than the published / default revision.
$this->instance = $this
->getMockInstance(300);
$formState = $this
->prophesize(FormStateInterface::CLASS);
$actual = $this->instance
->buildForm([], $formState
->reveal());
$this
->arrayHasKey('#title', $actual);
// Like above but now we're confirming the question has made it into the
// form.
$this
->assertEquals("Are you sure you want to %action to the revision from %revision-date?", $actual['#title']
->getUntranslatedString());
$args = $actual['#title']
->getArguments();
$this
->assertEquals([
'%revision-date' => 1200,
'%action' => 'revert',
], $args);
$this
->assertArrayHasKey('#attributes', $actual);
$this
->assertEquals([
'class' => [
0 => 'confirmation',
],
], $actual['#attributes']);
$this
->assertEquals([
'#type',
'submit',
'cancel',
], array_keys($actual['actions']));
$this
->assertArrayHasKey('#theme', $actual);
$this
->assertEquals('confirm_form', $actual['#theme']);
}