コード例 #1
0
 function test_staging_urls_return_no_matches()
 {
     # Test paths for common staging urls
     $test_items = array('staging.internal', 'dev.internal', 'preprod');
     foreach ($test_items as $value) {
         $solr = new Solr();
         $this->assertEqual(0, $solr->count($value), "Search for " . Helpers::search_link($value) . " returns " . $solr->count() . " results, when none should be returned");
     }
 }
 function test_phrases_in_index_return_matches()
 {
     # Checks first that searching for the phrase inside quotes does match
     # If it does, checks for matches without quotes.
     $test_items = array('"animals in circuses"', '"This Chinese official"', '"This Taihape Area School"', '"refers to Waitangi as"', '"posted on any forum"', '"highest level of their interest and ability"');
     foreach ($test_items as $value) {
         $solr = new Solr();
         if ($solr->count($value) >= 1) {
             $value = trim($value, '"');
             $solr = new Solr();
             $this->assertNotEqual(0, $solr->count($value), Helpers::search_link($value) . " has " . $solr->count() . " results");
         }
     }
 }
コード例 #3
0
 function test_search_by_id_returns_single_record()
 {
     # Check that searching for an ID only gives you one result
     $test_items = array('TKI80868', 'TKI80039', 'TKI80875');
     foreach ($test_items as $value) {
         $solr = new Solr();
         $this->assertEqual(1, $solr->count($value), Helpers::search_link($value) . " should return only 1 result");
     }
 }
 function test_legacy_paths_not_indexed_with_nonlegacy_domains()
 {
     # Searches for legacy urls on non-legacy domains, like:
     # gifted.tki.org.nz/m/search/
     $test_domains = array('gifted.tki.org.nz', 'www.wicked.org.nz', 'assessment.tki.org.nz', 'nzcurriculum.tki.org.nz', 'secondary.tki.org.nz', 'englishonline.tki.org.nz', 'artsonline.tki.org.nz');
     $test_paths = array('/e/community/ncea/', '/e/community/maorieducation/', '/e/community/pasifika/', '/m/search/', '/e/search/', '/r/literacy_numeracy/professional/teachers_notes/ready_to_read/');
     foreach ($test_domains as $domain) {
         foreach ($test_paths as $path) {
             $solr = new Solr();
             $query = $domain . $path;
             $this->assertEqual(0, $solr->count($query), Helpers::search_link($query) . " should return no results");
         }
     }
 }