You are here

function LocationCCKTest::testMultipleLocationOnSingleNode in Location 6.3

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

File

tests/location_cck.test, line 182

Class

LocationCCKTest

Code

function testMultipleLocationOnSingleNode() {
  $settings = array();
  $location_type = $this
    ->addLocationContentType($settings, array(
    'cck_multiple' => 10,
  ));
  $location1_name = $this
    ->randomName();
  $location2_name = $this
    ->randomName();
  $location3_name = $this
    ->randomName();
  $node = $this
    ->drupalCreateNode(array(
    'type' => $location_type,
    'field_loctest' => array(
      array(
        'name' => $location1_name,
      ),
      array(
        'name' => $location2_name,
      ),
      array(
        'name' => $location3_name,
      ),
    ),
  ));

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