protected function TaxTestBase::createTaxRate in Ubercart 8.4
Defines a new tax rate.
Parameters
string $plugin_id: ID of the UbercartTaxRate plugin to use.
array $values: Values to insert into the tax rate entity form.
Return value
\Drupal\uc_tax\TaxRateInterface The TaxRate entity that was created.
1 call to TaxTestBase::createTaxRate()
- TaxRateUiTest::testTaxUi in uc_tax/
tests/ src/ Functional/ TaxRateUiTest.php - Tests the operation of the tax rate configuration user interface.
File
- uc_tax/
tests/ src/ Functional/ TaxTestBase.php, line 49
Class
- TaxTestBase
- Provides a common set-up and utility routines for tax tests.
Namespace
Drupal\Tests\uc_tax\FunctionalCode
protected function createTaxRate($plugin_id, array $values = []) {
$has_user = $this->loggedInUser;
if (!$has_user) {
$this
->drupalLogin($this->adminUser);
}
$values += [
'id' => strtolower($this
->randomMachineName()),
'label' => $this
->randomString(),
];
$this
->drupalGet('admin/store/config/tax/add/' . $plugin_id);
$this
->submitForm($values, 'Save tax rate');
if (!$has_user) {
$this
->drupalLogout();
}
return TaxRate::load($values['id']);
}