You are here

class CommerceReportsUITestCase in Commerce Reporting 7.4

Class CommerceReportsUITestCase

Hierarchy

Expanded class hierarchy of CommerceReportsUITestCase

File

src/Tests/CommerceReportsUITestCase.php, line 8

Namespace

Drupal\commerce_reports\Tests
View source
class CommerceReportsUITestCase extends CommerceReportsBaseTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Reports user interface',
      'description' => 'Test the reports user interface.',
      'group' => 'Commerce Reports',
    );
  }
  protected function _getLinks($label) {
    $links = $this
      ->xpath('//a[normalize-space(text())=:label]', array(
      ':label' => $label,
    ));
    return $links;
  }
  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,
      )));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommerceReportsBaseTestCase::$additional_modules protected property
CommerceReportsBaseTestCase::$customers protected property
CommerceReportsBaseTestCase::$orders protected property
CommerceReportsBaseTestCase::$products protected property
CommerceReportsBaseTestCase::$profile protected property Don't need most of default core modules.
CommerceReportsBaseTestCase::$store_admin protected property
CommerceReportsBaseTestCase::createCustomers protected function Helper function creating multiple dummy customers.
CommerceReportsBaseTestCase::createdCustomersData protected function Returns information about created customers for tests.
CommerceReportsBaseTestCase::createdProductsData protected function Returns information about created products for tests.
CommerceReportsBaseTestCase::createOrders protected function Helper function creating multiple dummy orders. If no customers or products exist, then one of each get created.
CommerceReportsBaseTestCase::createProducts protected function Helper function creating multiple dummy products with a variable price.
CommerceReportsBaseTestCase::getTotal protected function
CommerceReportsBaseTestCase::getView protected function Return a an executed View.
CommerceReportsBaseTestCase::permissionBuilder protected function Overrides CommerceBaseTestCase::permissionBuilder().
CommerceReportsBaseTestCase::setUp function Overrides DrupalWebTestCase::setUp(). 3
CommerceReportsUITestCase::getInfo public static function
CommerceReportsUITestCase::testMenuIntegration public function
CommerceReportsUITestCase::_getLinks protected function