public function CommerceNodeCheckoutExpireTests::setUp in Commerce Node Checkout 7
Implementation of setUp().
Overrides CommerceNodeCheckoutBaseTest::setUp
File
- commerce_node_checkout_expire/commerce_node_checkout_expire.test, line 25 
- Provides tests for Commerce Node Checkout Expire process.
Class
- CommerceNodeCheckoutExpireTests
- Test class.
Code
public function setUp() {
  parent::setUp(array(
    'date_api',
    'date',
    'date_popup',
    'interval',
    'commerce_node_checkout_expire',
  ));
  // Load the product we've created
  $product = commerce_product_load_by_sku('std-listing');
  // Set the expiration of 5 minutes
  $wrapper = entity_metadata_wrapper('commerce_product', $product);
  $wrapper->commerce_node_checkout_expire
    ->set(array(
    'interval' => 5,
    'period' => 'minute',
  ));
  $this
    ->assertTrue((bool) $wrapper
    ->save(), 'Expiration interval set on product');
  // Set the node type to accept notifications
  commerce_node_checkout_expire_add_notifications_field('page');
  // See if the field was added to the page node
  $this
    ->assertTrue((bool) field_info_field(COMMERCE_NODE_CHECKOUT_NOTIFICATION_FIELD), 'Node (notification) field is present');
  // Check the line item fields
  $this
    ->assertTrue((bool) field_info_field('commerce_node_checkout_node'), 'Line item (associated node) field is present');
  $this
    ->assertTrue((bool) field_info_field('commerce_node_checkout_expires'), 'Line item (unpublish on) field is present');
}