addValue('first_name', uniqid())->execute()->single()['id']; $a1 = Address::create(FALSE) ->addValue('is_primary', TRUE) ->addValue('contact_id', $cid) ->addValue('location_type_id', 1) ->addValue('city', 'Somewhere') ->execute(); $a2 = Address::create(FALSE) ->addValue('is_primary', TRUE) ->addValue('contact_id', $cid) ->addValue('location_type_id', 2) ->addValue('city', 'Elsewhere') ->execute(); $addresses = Address::get(FALSE) ->addWhere('contact_id', '=', $cid) ->addOrderBy('id') ->execute(); $this->assertFalse($addresses[0]['is_primary']); $this->assertTrue($addresses[1]['is_primary']); } }