public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     // situation is as follows:
     // we have 2 objects, an image and a dataset
     // the image is related to homer (creator) and bart (publisher)
     // the dataset is just related to bart (creator)
     $vn_image_id = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test image"))));
     $this->assertGreaterThan(0, $vn_image_id);
     $vn_dataset_id = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'dataset'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test dataset"))));
     $this->assertGreaterThan(0, $vn_dataset_id);
     $vn_homer_id = $this->addTestRecord('ca_entities', array('intrinsic_fields' => array('type_id' => 'ind', 'idno' => 'hjs'), 'preferred_labels' => array(array("locale" => "en_US", "forename" => "Homer", "middlename" => "J.", "surname" => "Simpson")), 'related' => array('ca_objects' => array(array('object_id' => $vn_image_id, 'type_id' => 'creator', 'effective_date' => '2015', 'source_info' => 'Me')))));
     $this->assertGreaterThan(0, $vn_homer_id);
     $vn_bart_id = $this->addTestRecord('ca_entities', array('intrinsic_fields' => array('type_id' => 'ind', 'idno' => 'bs'), 'preferred_labels' => array(array("locale" => "en_US", "forename" => "Bart", "surname" => "Simpson")), 'related' => array('ca_objects' => array(array('object_id' => $vn_image_id, 'type_id' => 'publisher', 'effective_date' => '2015', 'source_info' => 'Me'), array('object_id' => $vn_dataset_id, 'type_id' => 'creator', 'effective_date' => '2015', 'source_info' => 'Me')))));
     $this->assertGreaterThan(0, $vn_bart_id);
     // search queries
     $this->setSearchQueries(array('My test image' => 1, 'My test' => 2, 'Homer J. Simpson' => 1, '"Homer J. Simpson"' => 1, 'Bart Simpson' => 2, '"Bart Simpson"' => 2, 'Simp*' => 2, 'ca_entity_labels.displayname:"Homer J. Simpson"' => 1, 'ca_entity_labels.displayname:"Bart Simpson"' => 2, 'ca_entity_labels.displayname:"Homer"' => 1, 'ca_entity_labels.surname:"Simpson"' => 2, 'ca_entity_labels.forename:"Homer"' => 1, 'ca_entity_labels.forename:"Bart"' => 2, 'ca_entities.idno:"hjs"' => 1, 'ca_entity_labels.entity_id:' . $vn_homer_id => 1, 'ca_entity_labels.entity_id:"' . $vn_homer_id . '"' => 1, 'ca_entity_labels.entity_id:' . $vn_bart_id => 2, 'ca_entity_labels.entity_id:"' . $vn_bart_id . '"' => 2, 'entity_id:"' . $vn_homer_id . '"' => 1, 'entity_id:"' . $vn_bart_id . '"' => 2, 'ca_entity_labels.displayname:"John Doe"' => 0, 'John Doe' => 0, 'ca_entity_labels.displayname/creator:"Homer J. Simpson"' => 1, 'ca_entity_labels.displayname/creator:"Bart Simpson"' => 1, 'ca_entity_labels.displayname/creator:"John Doe"' => 0, 'ca_entity_labels.displayname/publisher:"Homer J. Simpson"' => 0, 'ca_entity_labels.displayname/publisher:"Bart Simpson"' => 1));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test image")))));
     // search queries
     $this->setSearchQueries(array('ca_objects.type_id:image' => 1, 'ca_object_labels.name:test' => 1, 'ca_objects.type_id:image AND ca_object_labels.name:test' => 1, 'ca_objects.type_id:image AND ca_object_labels.name:doesntexist' => 0, 'ca_objects.type_id:dataset AND ca_object_labels.name:test' => 0, 'ca_objects.type_id:dataset AND ca_object_labels.name:doesntexist' => 0, 'ca_objects.type_id:image OR ca_object_labels.name:test' => 1, 'ca_objects.type_id:image OR ca_object_labels.name:doesntexist' => 1, 'ca_objects.type_id:dataset OR ca_object_labels.name:test' => 1, 'ca_objects.type_id:dataset OR ca_object_labels.name:doesntexist' => 0));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test image")), 'attributes' => array('internal_notes' => array(array('internal_notes' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ullamcorper sapien nec velit porta luctus.')), 'external_link' => array(array('url_source' => 'My URL source')), 'dimensions' => array(array('dimensions_length' => '10 in', 'dimensions_weight' => '2 lbs')), 'integer_test' => array(array('integer_test' => 23), array('integer_test' => 1984)), 'currency_test' => array(array('currency_test' => '$100')), 'georeference' => array(array('georeference' => '1600 Amphitheatre Parkway, Mountain View, CA')), 'coverageNotes' => array(array('coverageNotes' => ''))))));
     // search queries
     $this->setSearchQueries(array('My Test Image' => 1, 'Lorem ipsum' => 1, 'ca_objects.internal_notes:"Lorem ipsum"' => 1, 'ca_objects.internal_notes:"Test Image"' => 0, 'My URL source' => 1, 'ca_objects.url_source:"My URL source"' => 1, 'ca_objects.url_source:"Lorem impsum"' => 0, 'ca_objects.dimensions_length:[9in to 11in]' => 1, 'ca_objects.dimensions_length:[0in to 10in]' => 1, 'ca_objects.dimensions_length:[0in to 9.99in]' => 0, 'ca_objects.dimensions_length:10in' => 1, 'ca_objects.dimensions_length:[25cm to 30cm]' => 1, 'ca_objects.dimensions_length:[25cm to 11in]' => 1, 'ca_objects.dimensions_length:[25cm to 9in]' => 0, 'ca_objects.dimensions_length:25.4cm' => 1, 'ca_objects.dimensions_length:25.3cm' => 0, 'ca_objects.dimensions_length:[0.5ft to 1ft]' => 1, 'ca_objects.dimensions_length:[1ft to 2ft]' => 0, 'ca_objects.dimensions_weight:2lbs' => 1, 'ca_objects.dimensions_weight:[1lbs to 2lbs]' => 1, 'ca_objects.dimensions_weight:[0.8kg to 0.9kg]' => 0, 'ca_objects.dimensions_weight:[0.8kg to 1kg]' => 1, 'ca_objects.dimensions_weight:[800g to 1kg]' => 1, 'ca_objects.dimensions_weight:[0.90kg to 0.91kg]' => 1, 'ca_objects.integer_test:[22 to 23]' => 1, 'ca_objects.integer_test:23' => 1, 'ca_objects.integer_test:[23 to 1984]' => 1, 'ca_objects.integer_test:[0 to 9]' => 0, 'ca_objects.integer_test:1984' => 1, 'ca_objects.integer_test:23 AND ca_objects.integer_test:1984' => 1, 'ca_objects.integer_test:24 AND ca_objects.integer_test:1984' => 0, 'ca_objects.currency_test:$100' => 1, 'ca_objects.currency_test:[$99.99 to $100.01]' => 1, 'ca_objects.currency_test:EUR100' => 0, 'ca_objects.currency_test:USD100' => 1, 'ca_objects.currency_test:CAD100' => 0, 'ca_objects.georeference:[36.4,-123.5 to 38.5,-121.9]' => 1, 'ca_objects.georeference:[36.4,-121.9 to 38.5,-123.5]' => 1, 'ca_objects.georeference:[38.5,-121.9 to 36.4,-123.5]' => 1, 'ca_objects.georeference:[40.0,-121.9 to 40.1,-123.5]' => 0, 'ca_objects.georeference:[38.5,-124.0 to 36.4,-123.5]' => 0, 'ca_objects.georeference:"[37.4224879,-122.08422 ~ 5km]"' => 1, 'ca_objects.georeference:"[40.0,-125.0 ~ 5km]"' => 0, 'ca_objects.georeference:"[36.4,-123.5 to 38.5,-121.9]"' => 1, 'ca_objects.georeference:"[36.4,-121.9 to 38.5,-123.5]"' => 1, 'ca_objects.georeference:"[38.5,-121.9 to 36.4,-123.5]"' => 1, 'ca_objects.georeference:"[40.0,-121.9 to 40.1,-123.5]"' => 0, 'ca_objects.georeference:"[38.5,-124.0 to 36.4,-123.5]"' => 0, 'ca_objects.coverageNotes:"[BLANK]"' => 1, 'ca_objects.description:"[BLANK]"' => 1, 'ca_objects.georeference:"[BLANK]"' => 0, 'ca_objects.currency_test:"[BLANK]"' => 0, 'ca_objects.integer_test:"[BLANK]"' => 0, 'ca_objects.dimensions_weight:"[BLANK]"' => 0, 'ca_objects.dimensions_length:"[BLANK]"' => 0, 'ca_objects.url_source:"[BLANK]"' => 0, 'ca_objects.internal_notes:"[BLANK]"' => 0, 'ca_objects.coverageNotes:[BLANK]' => 1, 'ca_objects.description:[BLANK]' => 1, 'ca_objects.georeference:[BLANK]' => 0, 'ca_objects.currency_test:[BLANK]' => 0, 'ca_objects.integer_test:[BLANK]' => 0, 'ca_objects.dimensions_weight:[BLANK]' => 0, 'ca_objects.dimensions_length:[BLANK]' => 0, 'ca_objects.url_source:[BLANK]' => 0, 'ca_objects.internal_notes:[BLANK]' => 0));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ullamcorper sapien nec velit porta luctus.")))));
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Lorem ipsum dolor sit amet, adipiscing consectetur elit: Test")))));
     // search queries
     $this->setSearchQueries(array('"Lorem ipsum"' => 2, '"Lorem ipsum sit amet"' => 0, '"Lorem ipsum test"' => 0, '"No results here"' => 0, '"consectetur adipiscing elit"' => 1, '"adipiscing consectetur elit"' => 1, '"adipiscing elit"' => 1, '"elit. Pellentesque"' => 1, '"elit Pellentesque"' => 1, '"elit: Test"' => 1, '"elit Test"' => 1, '"lorem ipsum"' => 2, '"Dolor Sit Amet"' => 2, '"DOLOR SIT AMET"' => 2, '"ELIT: TEST"' => 1, '"DOLOR SIT TEST"' => 0, '"DOLOR SIT test"' => 0));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test image")), 'attributes' => array('coverageDates' => array(array('coverageDates' => '01/28/1985 @ 10am'))))));
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Another test image")), 'attributes' => array('coverageDates' => array(array('coverageDates' => '1986'))))));
     // search queries
     $this->setSearchQueries(array('1985' => 1, '1986' => 1, 'ca_objects.coverageDates:"1985-1986"' => 2, 'ca_objects.coverageDates:"1985"' => 1, 'ca_objects.coverageDates:"01/1985"' => 1, 'ca_objects.coverageDates:"01-28-1985"' => 1, 'ca_objects.coverageDates:"01.28.1985"' => 1, 'ca_objects.coverageDates:"28-JAN-1985"' => 1, 'ca_objects.coverageDates:"28-JAN-85"' => 1, 'ca_objects.coverageDates:"1980s"' => 2, 'ca_objects.coverageDates:"Winter 1985"' => 1, 'ca_objects.coverageDates:"Spring 2015"' => 0, 'ca_objects.coverageDates:"circa 1985"' => 1, 'ca_objects.coverageDates:"20th century"' => 2, 'ca_objects.coverageDates:"198-"' => 2, 'ca_objects.coverageDates:"1990\'s"' => 0, 'ca_objects.coverageDates:"1980\'s"' => 2, 'ca_objects.coverageDates:"Between June 5, 2007 and June 15 2007"' => 0, 'ca_objects.coverageDates:"Between January 27, 1985 and January 29 1985"' => 1, 'ca_objects.coverageDates:"Between January 01, 1985 and December 31 1986"' => 2, 'ca_objects.coverageDates:"June 5, 2007 - June 15, 2007"' => 0, 'ca_objects.coverageDates:"January 27, 1985 - January 29, 1985"' => 1, 'ca_objects.coverageDates:"January 1, 1985 - December 31, 1986"' => 2, 'ca_objects.coverageDates:"From 6/5/2007 to 6/15/2007"' => 0, 'ca_objects.coverageDates:"From 1/27/1985 to 1/29/1985"' => 1, 'ca_objects.coverageDates:"From 1/1/1985 to 12/31/1986"' => 2, 'ca_objects.coverageDates:"1/28/1985 @ 8am - 1/28/1985 @ 9am"' => 0, 'ca_objects.coverageDates:"1/28/1985 @ 9am - 1/28/1985 @ 11am"' => 1, 'ca_objects.coverageDates:"1/28/1986 @ 8am - 1/28/1986 @ 9am"' => 1));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image', 'access' => 1, 'status' => 4))));
     $vn_image_type_id = ca_lists::getItemID('object_types', 'image');
     // search queries
     $this->setSearchQueries(array('ca_objects.type_id:"image"' => 1, 'ca_objects.type_id:image' => 1, 'ca_objects.type_id:"' . $vn_image_type_id . '"' => 1, 'ca_objects.type_id:' . $vn_image_type_id => 1, 'ca_objects.type_id:"' . ($vn_image_type_id - 1) . '"' => 0, 'ca_objects.status:4' => 1, 'ca_objects.status:"4"' => 1, 'ca_objects.status:44' => 0, 'ca_objects.status:"44"' => 0, 'ca_objects.access:1' => 1, 'ca_objects.access:"1"' => 1, 'ca_objects.access:0' => 0, 'ca_objects.access:"0"' => 0, 'ca_objects.is_deaccessioned:"0"' => 1, 'ca_objects.is_deaccessioned:0' => 1));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $vn_lot_id = $this->addTestRecord('ca_object_lots', array('intrinsic_fields' => array('type_id' => 'purchase', 'idno_stub' => 'test_purchase', 'lot_status_id' => 'accessioned'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "A test purchase")), 'attributes' => array('description' => array(array('description' => 'Bacon ipsum dolor amet turkey brisket hamburger drumstick pork belly beef flank ham tongue')), 'coverageDates' => array(array('coverageDates' => 'January 1985')))));
     $this->assertGreaterThan(0, $vn_lot_id);
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image', 'lot_id' => $vn_lot_id), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test image")))));
     // search queries
     $this->setSearchQueries(array('My Test Image' => 1, '"Bacon ipsum"' => 1, 'ca_object_lots.description:"Bacon ipsum"' => 1, 'ca_object_lots.coverageDates:"1985"' => 1, 'ca_object_lots.coverageDates:"1984"' => 0));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image', 'idno' => 'D.99/2-38'))));
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image', 'idno' => 'D.99/2-39'))));
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image', 'idno' => 'D.99/0000001'))));
     $this->assertGreaterThan(0, $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image', 'idno' => '01 02 03 04'))));
     // search queries
     $this->setSearchQueries(array('ca_objects.idno:"D.99/2-38"' => 1, 'ca_objects.idno:"D.99/2-39"' => 1, 'ca_objects.idno:"D.99/2-40"' => 0, 'ca_objects.idno:"D.99/2-"' => 0, 'D.99' => 3, 'D.99/2-39' => 1, 'D' => 3, 'D.99/2' => 2, 'D. 99' => 0, 'D.99/0000001' => 1, 'D.99/1' => 1, '01 02 03 04' => 1, '01 02' => 1, '03 04' => 1, '1 2 3 4' => 1));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $vn_test_vocab_item_id = caGetListItemID('test_vocab', 'test');
     $this->assertGreaterThan(0, $vn_test_vocab_item_id);
     $vn_image_id = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Just an image")), 'related' => array('ca_list_items' => array(array('item_id' => $vn_test_vocab_item_id, 'type_id' => 'depicts')))));
     $this->assertGreaterThan(0, $vn_image_id);
     // search queries
     $this->setSearchQueries(array('Just an image' => 1, 'Foo' => 1, '"Foo"' => 1, 'Bar' => 1, '"Bar"' => 1, 'ca_list_item_labels.name_singular:"Foo"' => 1, 'ca_list_item_labels.name_singular:"Bar"' => 1, 'Baz' => 0, '"Baz"' => 0, 'ca_list_item_labels.name_singular:"Baz"' => 0));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // log in as admin so we can test user-specific change log search
     /** @var RequestHTTP $g_request */
     global $g_request;
     $g_request->doAuthentication(array('user_name' => 'administrator', 'password' => 'dublincore', 'dont_redirect_to_login' => true, 'no_headers' => true));
     // search subject table
     $this->setPrimaryTable('ca_objects');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $this->assertGreaterThan(0, $vn_record_id = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'image', 'access' => 1, 'status' => 4))));
     // search queries
     $this->setSearchQueries(array('created:' . date('Y') => 1, 'created.administrator:' . date('Y') => 1, 'created.cataloguer:' . date('Y') => 0, 'created:"1985-1986"' => 0, 'created:"2000-2020"' => 1));
 }
 public function setUp()
 {
     // don't forget to call parent so that request is set up correctly
     parent::setUp();
     // search subject table
     $this->setPrimaryTable('ca_storage_locations');
     /**
      * @see http://docs.collectiveaccess.org/wiki/Web_Service_API#Creating_new_records
      * @see https://gist.githubusercontent.com/skeidel/3871797/raw/item_request.json
      */
     $vn_building = $this->addTestRecord('ca_storage_locations', array('intrinsic_fields' => array('type_id' => 'building', 'parent_id' => 1), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Test Building"))));
     $vn_floor = $this->addTestRecord('ca_storage_locations', array('intrinsic_fields' => array('type_id' => 'floor', 'parent_id' => $vn_building), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Test Floor"))));
     $vn_room = $this->addTestRecord('ca_storage_locations', array('intrinsic_fields' => array('type_id' => 'room', 'parent_id' => $vn_floor), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Test Room"))));
     $this->assertGreaterThan(0, $vn_building);
     $this->assertGreaterThan(0, $vn_floor);
     $this->assertGreaterThan(0, $vn_room);
     // search queries
     $this->setSearchQueries(array('Test' => 3, 'ca_storage_location_labels.name:"Test"' => 3, 'ca_storage_location_labels.name:"Building"' => 3, 'ca_storage_location_labels.name:"Room"' => 1));
 }