You are here

function CowInstanceTest::testMultipleLocationOnSingleNode in Location 6.3

Same name and namespace in other branches
  1. 7.5 tests/cow.test \CowInstanceTest::testMultipleLocationOnSingleNode()
  2. 7.3 tests/cow.test \CowInstanceTest::testMultipleLocationOnSingleNode()
  3. 7.4 tests/cow.test \CowInstanceTest::testMultipleLocationOnSingleNode()

File

tests/cow.test, line 88

Class

CowInstanceTest

Code

function testMultipleLocationOnSingleNode() {
  $settings = array();
  $location_type = $this
    ->addLocationContentType($settings, array(
    'multiple' => array(
      'max' => 3,
      'add' => 3,
    ),
  ));
  $location1_name = $this
    ->randomName();
  $location2_name = $this
    ->randomName();
  $location3_name = $this
    ->randomName();
  $node = $this
    ->drupalCreateNode(array(
    'type' => $location_type,
    'locations' => array(
      0 => array(
        'name' => $location1_name,
        'location_settings' => $settings,
      ),
      1 => array(
        'name' => $location2_name,
        'location_settings' => $settings,
      ),
      2 => array(
        'name' => $location3_name,
        'location_settings' => $settings,
      ),
    ),
  ));

  // Reload the node.
  $node2 = node_load($node->nid, NULL, TRUE);
  $this
    ->assertEqual($location1_name, $node2->locations[0]['name'], t('Testing multi location 1/3'));
  $this
    ->assertEqual($location2_name, $node2->locations[1]['name'], t('Testing multi location 2/3'));
  $this
    ->assertEqual($location3_name, $node2->locations[2]['name'], t('Testing multi location 3/3'));
  $this
    ->assertNotEqual($node2->locations[0]['lid'], $node2->locations[1]['lid'], t('Ensuring location id uniqueness'));
  $this
    ->assertNotEqual($node2->locations[1]['lid'], $node2->locations[2]['lid'], t('Ensuring location id uniqueness'));
  $this
    ->assertNotEqual($node2->locations[2]['lid'], $node2->locations[0]['lid'], t('Ensuring location id uniqueness'));
}