You are here

public function PluginSelectTest::testPluginSelectWithoutConfiguration in Commerce Core 8.2

Tests the plugin_select widget on a plugin type without configuration.

File

tests/src/FunctionalJavascript/PluginSelectTest.php, line 86

Class

PluginSelectTest
Tests the plugin select widgets.

Namespace

Drupal\Tests\commerce\FunctionalJavascript

Code

public function testPluginSelectWithoutConfiguration() {
  $this
    ->createField('commerce_payment_method_type');
  $display = commerce_get_entity_display('entity_test', 'entity_test', 'form');
  $display
    ->setComponent('test_plugin', [
    'type' => 'commerce_plugin_select',
  ])
    ->save();
  $entity = $this
    ->createEntity('entity_test', [
    'name' => 'Test',
  ]);
  $this
    ->drupalGet($entity
    ->toUrl('edit-form'));
  $this
    ->submitForm([
    'test_plugin[0][target_plugin_id]' => 'paypal',
  ], 'Save');
  $this
    ->assertSession()
    ->pageTextContains('entity_test 1 has been updated.');
  $this->entityTestStorage
    ->resetCache([
    $entity
      ->id(),
  ]);
  $entity = $this->entityTestStorage
    ->load($entity
    ->id());
  $this
    ->assertEquals('paypal', $entity->test_plugin->target_plugin_id);
  $this
    ->assertEquals([], $entity->test_plugin->target_plugin_configuration);
}