public function CommercePaymentUITest::testCommercePaymentAccessPaymentAdministration in Commerce Core 7
Test the access to the payment/payment methods administration pages.
File
- modules/
payment/ tests/ commerce_payment_ui.test, line 227 - Functional tests for the commerce payment module user interface.
Class
- CommercePaymentUITest
- Test payment user interface.
Code
public function testCommercePaymentAccessPaymentAdministration() {
// Login with normal user.
$this
->drupalLogin($this->store_customer);
// Order creation, in cart status.
$this->order = $this
->createDummyOrder($this->store_customer->uid);
// Access payment administration page.
$this
->drupalGet('admin/commerce/orders/' . $this->order->order_id . '/payment');
$this
->assertResponse(403, t('Normal user is not able to access the payment administration page'));
// Access to the payment methods administration page.
$this
->drupalGet('admin/commerce/config/payment-methods');
$this
->assertResponse(403, t('Normal user is not able to access the payment methods administration page'));
// Login with store admin.
$this
->drupalLogin($this->store_admin);
// Access payment administration page.
$this
->drupalGet('admin/commerce/orders/' . $this->order->order_id . '/payment');
$this
->assertResponse(200, t('Store admin user can access the payment administration page'));
// Access to the payment methods administration page
$this
->drupalGet('admin/commerce/config/payment-methods');
$this
->assertResponse(200, t('Store admin user can access the payment methods administration page'));
}