function BlockDisplayVariantTest::testSubmitConfigurationForm

Same name in other branches
  1. 8.x-3.x tests/src/Unit/BlockDisplayVariantTest.php \Drupal\Tests\ctools\Unit\BlockDisplayVariantTest::testSubmitConfigurationForm()

Tests the submitConfigurationForm() method.

@covers ::submitConfigurationForm

@dataProvider providerTestSubmitConfigurationForm

File

tests/src/Unit/BlockDisplayVariantTest.php, line 33

Class

BlockDisplayVariantTest
Tests the block display variant plugin.

Namespace

Drupal\Tests\ctools\Unit

Code

public function testSubmitConfigurationForm($values) {
    $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);
    $display_variant = new class ([], '', [], $context_handler->reveal(), $account->reveal(), $uuid_generator->reveal(), $token->reveal(), $block_manager->reveal(), $condition_manager->reveal()) extends BlockDisplayVariant {
        
        /**
         * {@inheritdoc}
         */
        public function build() {
            return [];
        }
        
        /**
         *
         */
        public function getRegionNames() {
            return [
                'top' => 'Top',
                'bottom' => 'Bottom',
            ];
        }

};
    $form = [];
    $form_state = (new FormState())->setValues($values);
    $display_variant->submitConfigurationForm($form, $form_state);
    $this->assertSame($values['label'], $display_variant->label());
}