drupalGet($path, $options, $headers); $this->assertResponse(403); $this->drupalLogin($this->drupalCreateUser($permissions)); $this->drupalGet($path, $options, $headers); $this->assertResponse(200); } /** * Creates an address field (with the lookup handler) and attaches it. * * The entity and bundle to attach the field to are passed as parameters. * * @param string $name * The field name of the address field to create. * @param string $entity_type * The name of the entity type to attach the field to. * @param string $bundle * The name of the entity bundle to attach the field to. */ protected function createAttachAddressLookupField($name, $entity_type, $bundle) { // Create the field. $field = array( 'active' => 1, 'cardinality' => 1, 'deleted' => 0, 'entity_types' => array(), 'field_name' => $name, 'indexes' => array(), 'locked' => 0, 'module' => 'addressfield', 'settings' => array(), 'translatable' => 0, 'type' => 'addressfield', ); field_create_field($field); // Attach an instance of it. $instance = array( 'bundle' => $bundle, 'default_value' => NULL, 'deleted' => 0, 'description' => '', 'display' => array(), 'entity_type' => $entity_type, 'field_name' => $name, 'label' => 'Address', 'required' => 0, 'settings' => array( 'user_register_form' => FALSE, ), 'widget' => array( 'active' => 1, 'module' => 'addressfield', 'settings' => array( 'available_countries' => array(), 'default_country' => 'GB', 'format_handlers' => array( 'address' => 'address', 'address-hide-postal-code' => 0, 'address-hide-street' => 0, 'address-hide-country' => 0, 'organisation' => 0, 'name-full' => 0, 'name-oneline' => 0, 'address-optional' => 0, 'addressfield_lookup' => 'addressfield_lookup', ), ), 'type' => 'addressfield_standard', 'weight' => 7, ), ); field_create_instance($instance); } }