You are here

function MerciTestCase::merciCreateContentType in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2

Same name and namespace in other branches
  1. 6.2 tests/merci_testcase.php \MerciTestCase::merciCreateContentType()
1 call to MerciTestCase::merciCreateContentType()
MerciTestCase::merciCreateItem in tests/merci_testcase.php

File

tests/merci_testcase.php, line 92
Simpletest case for node_example module.

Class

MerciTestCase
Functionality tests for merci module. General setup and functions all merci tests should inherit.

Code

function merciCreateContentType($settings, $merci_type, $merci_settings = NULL) {

  // Create resource content type
  // Disable the rating for this content type: 0 for Disabled, 1 for Enabled.
  if (node_type_get_type($settings['type'])) {
    return $settings['type'];
  }
  $content_type = $this
    ->drupalCreateContentType($settings);
  $this
    ->verbose('settings ' . var_export($content_type, TRUE));
  $type = $content_type->type;
  $settings = array(
    'merci_type_setting' => $merci_type,
    'merci_max_hours_per_reservation' => 5,
  );
  if ($merci_settings) {
    $settings = $settings + $merci_settings;
  }
  $this
    ->drupalPost('admin/structure/types/manage/' . $type, $settings, t('Save content type'));
  $this
    ->assertResponse(200);
  $this
    ->assertRaw(' has been updated.', t('Settings modified successfully for content type.'));
  return $type;
}