You are here

public function CommerceReportsUITestCase::testMenuIntegration in Commerce Reporting 7.4

File

src/Tests/CommerceReportsUITestCase.php, line 24

Class

CommerceReportsUITestCase
Class CommerceReportsUITestCase

Namespace

Drupal\commerce_reports\Tests

Code

public function testMenuIntegration() {
  $paths = array(
    'admin/commerce/reports',
    'admin/commerce/reports/products',
    'admin/commerce/reports/customers',
    'admin/commerce/reports/sales',
    'admin/commerce/reports/payment-methods',
  );
  $this
    ->drupalLogin($this->store_admin);
  foreach ($paths as $path) {
    $this
      ->drupalGet($path);
    $this
      ->assertResponse(200, t('Store admin can access report: @path.', array(
      '@path' => $path,
    )));
  }
  $this
    ->drupalLogin($this
    ->createStoreCustomer());
  foreach ($paths as $path) {
    $this
      ->drupalGet($path);
    $this
      ->assertResponse(403, t('Customers cannot access report: @path.', array(
      '@path' => $path,
    )));
  }
}