public function CommerceBaseTesterTestCase::testTestCreateDummyOrder in Commerce Core 7
Test the createDummyOrder function.
File
- tests/
commerce_base.test, line 899 - Defines abstract base test class for the Commerce module tests.
Class
- CommerceBaseTesterTestCase
- Test class to test the CommerceBaseTestCase functions. All testTestFoo functions have "testTest" in the name to indicate that they are verifying that a test is working. Somewhat "meta" to do this, but it eases test development.
Code
public function testTestCreateDummyOrder() {
$normal_user = $this
->drupalCreateUser(array(
'access checkout',
));
$this
->drupalLogin($normal_user);
$sku = 'PROD-01';
$product_name = 'Product One';
$product = $this
->createDummyProduct($sku, $product_name);
$order = $this
->createDummyOrder($normal_user->uid, array(
$product->product_id => 1,
));
// Check if the order is in cart status.
$this
->assertTrue(commerce_cart_order_is_cart($order), t('Order is in a shopping cart status'));
$this
->drupalGet('checkout');
$this
->assertTitle(t('Checkout') . ' | Drupal', t('Checkout accessible for the order'));
$this
->assertText($product_name, t('Product is added to the order'));
}