CustomerAdminTest.php in Ubercart 8.4
File
uc_order/tests/src/Functional/CustomerAdminTest.php
View source
<?php
namespace Drupal\Tests\uc_order\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\uc_country\Entity\Country;
use Drupal\uc_order\Entity\Order;
class CustomerAdminTest extends BrowserTestBase {
protected static $modules = [
'uc_order',
'views',
];
protected $strictConfigSchema = FALSE;
protected $adminUser;
protected $customer;
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'access administration pages',
'access user profiles',
'view customers',
]);
$this->customer = $this
->drupalCreateUser();
}
public function testCustomerAdminPages() {
$this
->drupalLogin($this->adminUser);
$assert = $this
->assertSession();
$country = Country::load('US');
Order::create([
'uid' => $this->customer
->id(),
'billing_country' => $country
->id(),
'billing_zone' => 'AK',
])
->save();
$this
->drupalGet('admin/store/customers/view');
$assert
->statusCodeEquals(200);
$assert
->linkByHrefExists('user/' . $this->customer
->id());
$assert
->pageTextContains($country
->getZones()['AK']);
$assert
->pageTextContains($country
->label());
}
}