public function PageBlockDisplayVariantTest::testSubmitConfigurationForm in Page Manager 8.4
Same name and namespace in other branches
- 8 tests/src/Unit/PageBlockDisplayVariantTest.php \Drupal\Tests\page_manager\Unit\PageBlockDisplayVariantTest::testSubmitConfigurationForm()
Tests the submitConfigurationForm() method.
@covers ::submitConfigurationForm
File
- tests/
src/ Unit/ PageBlockDisplayVariantTest.php, line 209
Class
- PageBlockDisplayVariantTest
- Tests the block variant plugin.
Namespace
Drupal\Tests\page_manager\UnitCode
public function testSubmitConfigurationForm() {
$account = $this
->prophesize(AccountInterface::class);
$context_handler = $this
->prophesize(ContextHandlerInterface::class);
$uuid_generator = $this
->prophesize(UuidInterface::class);
$token = $this
->prophesize(Token::class);
$block_manager = $this
->prophesize(BlockManager::class);
$condition_manager = $this
->prophesize(ConditionManager::class);
$module_handler = $this
->prophesize(ModuleHandlerInterface::class);
$variant_plugin = new PageBlockDisplayVariant([], '', [], $context_handler
->reveal(), $account
->reveal(), $uuid_generator
->reveal(), $token
->reveal(), $block_manager
->reveal(), $condition_manager
->reveal(), $module_handler
->reveal());
$values = [
'page_title' => "Go hang a salami, I'm a lasagna hog!",
];
$form = [];
$form_state = (new FormState())
->setValues($values);
$variant_plugin
->submitConfigurationForm($form, $form_state);
$property = new \ReflectionProperty($variant_plugin, 'configuration');
$property
->setAccessible(TRUE);
$this
->assertSame($values['page_title'], $property
->getValue($variant_plugin)['page_title']);
}