You are here

public function ViewsIntegrationTest::testViewsData in Commerce Reporting 8

File

tests/src/Kernel/ViewsIntegrationTest.php, line 27

Class

ViewsIntegrationTest
Test Views integration.

Namespace

Drupal\Tests\commerce_reports\Kernel

Code

public function testViewsData() {
  $views_data = $this->container
    ->get('views.views_data')
    ->getAll();

  // Assert that the bundle field tables exist.
  $this
    ->assertNotEmpty($views_data['commerce_order_report__order_type_id']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__amount']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__mail']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__billing_address']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__order_item_type_id']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__order_item_id']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__title']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__quantity']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__unit_price']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__total_price']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__adjusted_unit_price']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__adjusted_total_price']);

  // Make sure hook_field_views_data() is respected.
  $this
    ->assertNotEmpty($views_data['commerce_order_report__amount']['amount_number']['field']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__unit_price']['unit_price_number']['field']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__total_price']['total_price_number']['field']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__adjusted_unit_price']['adjusted_unit_price_number']['field']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__adjusted_total_price']['adjusted_total_price_number']['field']);
  $this
    ->assertNotEmpty($views_data['commerce_order_report__billing_address']['billing_address_country_code']['field']);
}