You are here

public function UbercartCartLinksTestCase::createCartLinksPage in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_cart_links/tests/uc_cart_links.test \UbercartCartLinksTestCase::createCartLinksPage()

Create a page with cart links in the body.

Parameters

$links: Array of cart links to appear on page.

7 calls to UbercartCartLinksTestCase::createCartLinksPage()
UbercartCartLinksTestCase::testCartLinksAllowEmptying in uc_cart_links/uc_cart_links.test
Tests cart links on a page under a variety of conditions.
UbercartCartLinksTestCase::testCartLinksBasicFunctionality in uc_cart_links/uc_cart_links.test
Tests cart links on a page under a variety of conditions.
UbercartCartLinksTestCase::testCartLinksMessages in uc_cart_links/uc_cart_links.test
Tests cart links messages.
UbercartCartLinksTestCase::testCartLinksProductActionMessage in uc_cart_links/uc_cart_links.test
Tests cart links on a page under a variety of conditions.
UbercartCartLinksTestCase::testCartLinksRedirect in uc_cart_links/uc_cart_links.test
Tests page redirection for invalid cart links.

... See full list

File

uc_cart_links/uc_cart_links.test, line 696
Ubercart Cart Links Tests.

Class

UbercartCartLinksTestCase
SimpleTests for Ubercart Cart Links.

Code

public function createCartLinksPage($links = array()) {
  if (!empty($links)) {
    $i = 0;
    foreach ($links as $link) {
      $body['links'][] = array(
        'title' => t('Cart Link #@num', array(
          '@num' => $i++,
        )),
        'href' => $link,
      );
    }
  }
  $page = array(
    'type' => 'page',
    // This is default anyway ...
    'body' => isset($body) ? theme('links', $body['links']) : $this
      ->randomName(128),
    'format' => FILTER_FORMAT_DEFAULT,
  );
  return $this
    ->drupalCreateNode($page);
}