You are here

public function BlockDisplayVariantTest::testSubmitConfigurationForm in Chaos Tool Suite (ctools) 8.3

Tests the submitConfigurationForm() method.

@covers ::submitConfigurationForm

@dataProvider providerTestSubmitConfigurationForm

File

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

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());
}