1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8class Search_Query_OrderTest extends PHPUnit_Framework_TestCase 9{ 10 /** 11 * @dataProvider sortMatches 12 */ 13 function testParse($mode, $field, $order, $type) 14 { 15 $obtained = Search_Query_Order::parse($mode); 16 $this->assertEquals(new Search_Query_Order($field, $type, $order), $obtained); 17 } 18 19 function sortMatches() 20 { 21 return [ 22 ['', 'score', 'desc', 'numeric'], 23 ['title', 'title', 'asc', 'text'], 24 ['title_asc', 'title', 'asc', 'text'], 25 ['title_desc', 'title', 'desc', 'text'], 26 ['title_nasc', 'title', 'asc', 'numeric'], 27 ['title_ndesc', 'title', 'desc', 'numeric'], 28 ['modification_date_ndesc', 'modification_date', 'desc', 'numeric'], 29 ]; 30 } 31} 32