You are here

protected function AjaxTest::createQuote in Ubercart 8.4

Creates a new quote.

Parameters

array $edit: (optional) An associative array of shipping quote method fields to change from the defaults. Keys are shipping quote method field names. For example, 'plugin' => 'flatrate'.

Return value

\Drupal\uc_quote\ShippingQuoteMethodInterface The created ShippingQuoteMethod object.

1 call to AjaxTest::createQuote()
AjaxTest::testCheckoutPaneAjax in uc_store/tests/src/FunctionalJavascript/AjaxTest.php
Tests Ajax on the checkout panes.

File

uc_store/tests/src/FunctionalJavascript/AjaxTest.php, line 270

Class

AjaxTest
Tests Ajax updating of checkout and order pages.

Namespace

Drupal\Tests\uc_store\FunctionalJavascript

Code

protected function createQuote(array $edit = []) {

  // Create a flatrate.
  $edit += [
    'id' => $this
      ->randomMachineName(),
    'label' => $this
      ->randomMachineName(),
    'status' => 1,
    'weight' => 0,
    'plugin' => 'flatrate',
    'settings' => [
      'base_rate' => mt_rand(1, 10),
      'product_rate' => mt_rand(1, 10),
    ],
  ];
  $method = ShippingQuoteMethod::create($edit);
  $method
    ->save();
  return $method;
}