+ public function testCmpByArraylen()
+ {
+ // Array elements are phrases, we want to sort so longest phrases are first
+ $aList1 = array('hackney', 'bridge', 'london', 'england');
+ $aList2 = array('hackney', 'london', 'bridge');
+ $aList3 = array('bridge', 'hackney', 'london', 'england');
+
+ $this->assertEquals(0, \Nominatim\SimpleWordList::cmpByArraylen($aList1, $aList1));
+
+ // list2 "wins". Less array elements
+ $this->assertEquals(1, \Nominatim\SimpleWordList::cmpByArraylen($aList1, $aList2));
+ $this->assertEquals(-1, \Nominatim\SimpleWordList::cmpByArraylen($aList2, $aList3));
+
+ // list1 "wins". Same number of array elements but longer first element
+ $this->assertEquals(-1, \Nominatim\SimpleWordList::cmpByArraylen($aList1, $aList3));
+ }