public function CartLinksTest::testCartLinksUiSettingsPage in Ubercart 8.4
Tests access to admin settings page and tests default values.
File
- uc_cart_links/
src/ Tests/ CartLinksTest.php, line 58
Class
- CartLinksTest
- Tests the Cart Links functionality.
Namespace
Drupal\uc_cart_links\TestsCode
public function testCartLinksUiSettingsPage() {
// Access settings page by anonymous user.
$this
->drupalGet('admin/store/config/cart-links');
$this
->assertResponse(403);
$this
->assertText('Access denied');
$this
->assertText('You are not authorized to access this page.');
// Access settings page by privileged user.
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/store/config/cart-links');
$this
->assertResponse(200);
$this
->assertText('View the help page to learn how to create Cart Links.', 'Settings page found.');
$this
->assertFieldByName('uc_cart_links_add_show', 0, 'Display Cart Links product action messages is off.');
$this
->assertFieldByName('uc_cart_links_track', 1, 'Track clicks is on.');
$this
->assertFieldByName('uc_cart_links_empty', 1, 'Allow Cart Links to empty carts is on.');
$this
->assertFieldByName('uc_cart_links_messages', '', 'Cart Links messages is empty.');
$this
->assertFieldByName('uc_cart_links_restrictions', '', 'Cart Links restrictions is empty.');
// Test presence of and contents of Help page.
$this
->clickLink('View the help page');
$this
->assertText('http://www.example.com/cart/add/<cart_link_content>', 'Help text found.');
}