diff --git a/uc_order/src/OrderViewsData.php b/uc_order/src/OrderViewsData.php index ae8322d..9122991 100644 --- a/uc_order/src/OrderViewsData.php +++ b/uc_order/src/OrderViewsData.php @@ -215,107 +215,6 @@ class OrderViewsData extends EntityViewsData { ), ), ); - - $data[$prefix . '_countries']['table']['group'] = $group; - $data[$prefix . '_countries']['table']['join']['uc_orders'] = array( - 'table' => 'uc_countries', - 'left_field' => $prefix . '_country', - 'field' => 'country_id', - ); - $data[$prefix . '_countries']['country_id'] = array( - 'title' => t('ISO country code (numeric)'), - 'help' => t('The @field of the @address of the order.', ['@field' => t('numeric ISO country code'), '@address' => Unicode::strtolower($address)]), - 'argument' => array( - 'id' => 'numeric', - 'name field' => 'country_iso_code_2', - 'numeric' => TRUE, - 'validate type' => 'country_id', - ), - 'filter' => array( - 'id' => 'numeric', - ), - ); - $data[$prefix . '_countries']['country_name'] = array( - 'title' => t('Country'), - 'help' => t('The @field of the @address of the order.', ['@field' => t('country name'), '@address' => Unicode::strtolower($address)]), - 'field' => array( - 'id' => 'standard', - 'click sortable' => TRUE, - ), - 'sort' => array( - 'id' => 'standard', - ), - 'filter' => array( - 'id' => 'in_operator', - 'real field' => 'country_id', - 'options callback' => 'Drupal\uc_country\Controller\CountryController::countryOptionsCallback', - ), - ); - $data[$prefix . '_countries']['country_iso_code_2'] = array( - 'title' => t('ISO country code (2 characters)'), - 'help' => t('The @field of the @address of the order.', ['@field' => t('ISO country code'), '@address' => Unicode::strtolower($address)]), - 'field' => array( - 'id' => 'standard', - 'click sortable' => TRUE, - ), - 'sort' => array( - 'id' => 'standard', - ), - 'filter' => array( - 'id' => 'string', - ), - ); - $data[$prefix . '_countries']['country_iso_code_3'] = array( - 'title' => t('ISO country code (3 characters)'), - 'help' => t('The @field of the @address of the order.', ['@field' => t('ISO country code'), '@address' => Unicode::strtolower($address)]), - 'field' => array( - 'id' => 'standard', - 'click sortable' => TRUE, - ), - 'sort' => array( - 'id' => 'standard', - ), - 'filter' => array( - 'id' => 'string', - ), - ); - - $data[$prefix . '_zones']['table']['group'] = $group; - $data[$prefix . '_zones']['table']['join']['uc_orders'] = array( - 'table' => 'uc_countries_zones', - 'left_field' => $prefix . '_zone', - 'field' => 'zone_id', - ); - $data[$prefix . '_zones']['zone_name'] = array( - 'title' => t('State/Province'), - 'help' => t('The @field of the @address of the order.', ['@field' => t('state or province'), '@address' => Unicode::strtolower($address)]), - 'field' => array( - 'id' => 'standard', - 'click sortable' => TRUE, - ), - 'sort' => array( - 'id' => 'standard', - ), - 'filter' => array( - 'id' => 'in_operator', - 'real field' => 'zone_code', - 'options callback' => 'Drupal\uc_country\Controller\CountryController::zoneOptionsCallback', - ), - ); - $data[$prefix . '_zones']['zone_code'] = array( - 'title' => t('State/Province code'), - 'help' => t('The @field of the @address of the order.', ['@field' => t('state or province code'), '@address' => Unicode::strtolower($address)]), - 'field' => array( - 'id' => 'standard', - 'click sortable' => TRUE, - ), - 'sort' => array( - 'id' => 'standard', - ), - 'filter' => array( - 'id' => 'string', - ), - ); } $data['uc_orders']['total_weight'] = array( diff --git a/uc_order/src/Tests/CustomerAdminTest.php b/uc_order/src/Tests/CustomerAdminTest.php index 898f299..4e4f0a6 100644 --- a/uc_order/src/Tests/CustomerAdminTest.php +++ b/uc_order/src/Tests/CustomerAdminTest.php @@ -23,6 +23,13 @@ class CustomerAdminTest extends UbercartTestBase { protected $adminUser; /** + * A user created the order. + * + * @var \Drupal\user\UserInterface + */ + protected $customer; + + /** * Modules to enable. * * @var array @@ -33,6 +40,7 @@ class CustomerAdminTest extends UbercartTestBase { parent::setUp(); $this->adminUser = $this->drupalCreateUser(array('view customers')); + $this->customer = $this->drupalCreateUser(); } /** @@ -41,8 +49,16 @@ class CustomerAdminTest extends UbercartTestBase { function testCustomerAdminPages() { $this->drupalLogin($this->adminUser); + $order = \Drupal::entityTypeManager()->getStorage('order')->create(array( + 'uid' => $this->customer->id(), + // TODO 'billing_zone' => '', + // TODO 'billing_country' => '', + )); + $this->drupalGet('admin/store/customers/view'); $this->assertResponse(200); + $this->assertLinkByHref('user/' . $this->customer->id()); + // TODO: check Location has zone and country name } } diff --git a/uc_store/src/Tests/UbercartTestBase.php b/uc_store/src/Tests/UbercartTestBase.php index 20536b6..4d1029a 100644 --- a/uc_store/src/Tests/UbercartTestBase.php +++ b/uc_store/src/Tests/UbercartTestBase.php @@ -53,9 +53,9 @@ abstract class UbercartTestBase extends WebTestBase { protected $product; /** - * Overrides WebTestBase::setUp(). + * {@inheritdoc} */ - public function setUp() { + protected function setUp() { parent::setUp(); // Place the tabs and actions blocks as various tests use them.