Ticket #687: php-64bit-docid-test.patch

File php-64bit-docid-test.patch, 1.2 KB (added by Olly Betts, 9 years ago)

Patch to add testcase for PHP

  • xapian-bindings/php/smoketest.php

    diff --git a/xapian-bindings/php/smoketest.php b/xapian-bindings/php/smoketest.php
    index 809d2ab9..f8c3bf1b 100644
    a b if ($query->get_description() !== 'Query(b@2)') {  
    602602    exit(1);
    603603}
    604604
     605# Test 64-bit Xapian::docid.
     606# FIXME: Skip for 32-bit?
     607
     608$db1 = new XapianWritableDatabase("db1", Xapian::DB_CREATE_OR_OVERWRITE);
     609$db2 = new XapianWritableDatabase("db2", Xapian::DB_CREATE_OR_OVERWRITE);
     610$doc = new XapianDocument();
     611$doc->set_data("prose");
     612$doc->add_term("word");
     613
     614$max_id = 0xffffffff;
     615
     616$db1->replace_document($max_id, $doc);
     617$db2->replace_document($max_id, $doc);
     618
     619$db = new XapianDatabase();
     620$db->add_database($db1);
     621$db->add_database($db2);
     622
     623$enquire = new XapianEnquire($db);
     624$enquire->set_query(XapianQuery::MatchAll());
     625$mymset = $enquire->get_mset(0, 10);
     626
     627if ($mymset->size() !== 2) {
     628    print "MSet size not 2\n";
     629    exit(1);
     630}
     631
     632foreach ($mymset->begin() as $it => $did) {
     633    if ($it->get_document()->get_data() !== 'prose') {
     634        print "Document data was '{$it->get_document()->get_data()}' not 'prose'\n";
     635        exit(1);
     636    }
     637}
     638
    605639?>