You are here

public function CommerceNodeCheckoutTests::testAnonymousPublishing in Commerce Node Checkout 7

Test anonymous users can create content after payment.

File

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

Class

CommerceNodeCheckoutTests
Test class.

Code

public function testAnonymousPublishing() {

  // Create the page
  $this
    ->createPage();

  // Checkout
  $this
    ->checkout();

  // Login as admin.
  $this
    ->drupalLogin($this->admin);
  $this
    ->drupalGet('admin/content/node');

  // Check for the node and published status.
  $this
    ->assertRaw('Miniature pony', 'Found miniature pony node');
  $this
    ->assertRaw('published', 'Node is published');

  // Check that the created user is now the node owner
  $this
    ->assertLink('joe.bloggs@exam...', 0, 'The newly created user is now the node owner');

  // Load the node and see if its published (be sure to pass $reset = TRUE).
  $node = $this
    ->loadLastNode();
  $this
    ->assertTrue((bool) $node->status, 'The node is now published');

  // Check that the order status is completed
  $this
    ->drupalGet('admin/commerce/orders');
  $this
    ->assertRaw('Completed', 'The order status is completed');

  // Create a node that shouldn't go to the cart; which only admins
  // can do
  $this
    ->createPage(array(
    'commerce_node_checkout_skip' => 1,
  ));
}