You are here

public function CommerceNodeCheckoutBaseTest::loadLastNode in Commerce Node Checkout 7

Fully-load the last node that was created, bypassing the cache.

Return value

A node object, otherwise FALSE.

3 calls to CommerceNodeCheckoutBaseTest::loadLastNode()
CommerceNodeCheckoutBaseTest::createPage in ./commerce_node_checkout.test
Create a basic page node.
CommerceNodeCheckoutExpireTests::testCommerceNodeCheckoutExpire in commerce_node_checkout_expire/commerce_node_checkout_expire.test
Test everything we need to do with content, expiration, notifications, etc.
CommerceNodeCheckoutTests::testAnonymousPublishing in ./commerce_node_checkout.test
Test anonymous users can create content after payment.

File

./commerce_node_checkout.test, line 241
Provides tests for Commerce Node Checkout process.

Class

CommerceNodeCheckoutBaseTest
Base class for other test classes to extend.

Code

public function loadLastNode() {

  // Query for the newest node by node ID
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'node');
  $query
    ->propertyOrderBy('nid', 'DESC');
  $query
    ->range(0, 1);
  $results = $query
    ->execute();

  // Load an return the nod
  return isset($results['node']) ? node_load(key($results['node']), NULL, TRUE) : NULL;
}