You are here

public function CommerceCustomerUITest::testCommerceCustomerUINewProfileType in Commerce Core 7

Create a custom profile type form an helper module and test it.

File

modules/customer/tests/commerce_customer_ui.test, line 566
Commerce customer profile tests.

Class

CommerceCustomerUITest
Functional tests for the commerce customer UI module.

Code

public function testCommerceCustomerUINewProfileType() {

  // Enable the helper module that creates a new profile type.
  module_enable(array(
    'commerce_customer_profile_dummy_type',
  ));

  // Login with store admin.
  $this
    ->drupalLogin($this->store_admin);

  // Check the customer profile types.
  $this
    ->drupalGet('admin/commerce/customer-profiles/types');
  $this
    ->assertText(t('Dummy profile type'), t('Dummy profile type is available in the profile types listing page'));

  // Check the order fields.
  $this
    ->drupalGet('admin/commerce/config/order/fields');
  $this
    ->assertText(t('Dummy profile type'), t('Dummy profile type is present in the order reference fields'));

  // Check the checkout panes.
  $this
    ->drupalGet('admin/commerce/config/checkout/form');
  $this
    ->assertText(t('Dummy profile type'), t('Dummy profile type is present as checkout pane'));

  // Create an order for store customer.
  $order = $this
    ->createDummyOrder($this->store_customer->uid, array(), 'pending');

  // Check if the profile type is present.
  $this
    ->drupalGet('admin/commerce/orders/' . $order->order_id . '/edit');
  $this
    ->assertText(t('Dummy profile type'), t('Dummy profile type is present in the order edit form'));
}