TaxTestBase.php in Ubercart 8.4
File
uc_tax/tests/src/Functional/TaxTestBase.php
View source
<?php
namespace Drupal\Tests\uc_tax\Functional;
use Drupal\Tests\uc_store\Functional\UbercartBrowserTestBase;
use Drupal\uc_tax\Entity\TaxRate;
abstract class TaxTestBase extends UbercartBrowserTestBase {
protected static $modules = [
'uc_cart',
'uc_payment',
'uc_payment_pack',
'uc_tax',
];
protected static $adminPermissions = [
'administer taxes',
];
protected function setUp() {
parent::setUp();
$this
->drupalPlaceBlock('page_title_block');
}
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']);
}
}
Classes
Name |
Description |
TaxTestBase |
Provides a common set-up and utility routines for tax tests. |