コード例 #1
0
ファイル: SelectTest.php プロジェクト: ripaclub/sphinxsearch
 public function providerData()
 {
     // basic table
     $select0 = new Select();
     $select0->from('foo');
     $sqlPrep0 = $sqlStr0 = 'SELECT * FROM `foo`';
     $internalTests0 = ['processSelect' => [[['*']], '`foo`']];
     // table as TableIdentifier
     $select1 = new Select();
     $select1->from(new TableIdentifier('foo'));
     $sqlPrep1 = $sqlStr1 = 'SELECT * FROM `foo`';
     $internalTests1 = ['processSelect' => [[['*']], '`foo`']];
     // table list
     $select2 = new Select();
     $select2->from(['foo', 'bar']);
     $sqlPrep2 = $sqlStr2 = 'SELECT * FROM `foo`, `bar`';
     $internalTests2 = ['processSelect' => [[['*']], '`foo`, `bar`']];
     // table list (comma separated)
     $select3 = new Select();
     $select3->from('foo, baz');
     $sqlPrep3 = $sqlStr3 = 'SELECT * FROM `foo`, `baz`';
     $internalTests3 = ['processSelect' => [[['*']], '`foo`, `baz`']];
     // columns
     $select4 = new Select();
     $select4->from('foo')->columns(['bar', 'baz']);
     $sqlPrep4 = $sqlStr4 = 'SELECT `bar`, `baz` FROM `foo`';
     $internalTests4 = ['processSelect' => [[['`bar`'], ['`baz`']], '`foo`']];
     // columns with AS associative array
     $select5 = new Select();
     $select5->from('foo')->columns(['bar' => 'baz']);
     $sqlPrep5 = $sqlStr5 = 'SELECT `baz` AS `bar` FROM `foo`';
     $internalTests5 = ['processSelect' => [[['`baz`', '`bar`']], '`foo`']];
     // columns with AS associative array mixed
     $select6 = new Select();
     $select6->from('foo')->columns(['bar' => 'baz', 'bam']);
     $sqlPrep6 = $sqlStr6 = 'SELECT `baz` AS `bar`, `bam` FROM `foo`';
     $internalTests6 = ['processSelect' => [[['`baz`', '`bar`'], ['`bam`']], '`foo`']];
     // columns where value is Expression, with AS
     $select7 = new Select();
     $select7->from('foo')->columns(['bar' => new Expression('COUNT(*)')]);
     $sqlPrep7 = $sqlStr7 = 'SELECT COUNT(*) AS `bar` FROM `foo`';
     $internalTests7 = ['processSelect' => [[['COUNT(*)', '`bar`']], '`foo`']];
     // columns where value is Expression
     $select8 = new Select();
     $select8->from('foo')->columns([new Expression('COUNT(*) AS bar')]);
     $sqlPrep8 = $sqlStr8 = 'SELECT COUNT(*) AS bar FROM `foo`';
     $internalTests8 = ['processSelect' => [[['COUNT(*) AS bar']], '`foo`']];
     // columns where value is Expression with parameters
     $select9 = new Select();
     $select9->from('foo')->columns([new Expression('EXIST(?, 5) AS ?', ['baz', 'bar'], [Expression::TYPE_VALUE, Expression::TYPE_IDENTIFIER])]);
     $sqlPrep9 = 'SELECT EXIST(?, 5) AS `bar` FROM `foo`';
     $sqlStr9 = 'SELECT EXIST(\'baz\', 5) AS `bar` FROM `foo`';
     $params9 = ['column1' => 'baz'];
     $internalTests9 = ['processSelect' => [[['EXIST(?, 5) AS `bar`']], '`foo`']];
     // select without from and expression in column without alias
     $select10 = new Select();
     $select10->columns([new Expression('1+1')]);
     $sqlPrep10 = $sqlStr10 = 'SELECT 1+1 AS `Expression1`';
     $internalTests10 = ['processSelect' => [[['1+1', '`Expression1`']]]];
     // test join (silent ignore)
     $select11 = new Select();
     $select11->from('foo')->join('zac', 'm = n', ['bar', 'baz']);
     $sqlPrep11 = $sqlStr11 = 'SELECT * FROM `foo`';
     $internalTests11 = ['processSelect' => [[['*']], '`foo`']];
     // FIXME
     // NOTE: assuming float as literal [default behaviour]
     $platform = new TrustedSphinxQL();
     //use platform to ensure same float point precision
     $ten = $platform->quoteValue(10.0);
     $select12 = new Select();
     $select12->from('foo')->columns(['f1', 'test' => new Expression('?', 10.0)]);
     $sqlPrep12 = $sqlStr12 = 'SELECT `f1`, ' . $ten . ' AS `test` FROM `foo`';
     $internalTests12 = ['processSelect' => [[['`f1`'], [$ten, '`test`']], '`foo`']];
     //         // join with alternate type
     //         $select12 = new Select;
     //         $select12->from('foo')->join('zac', 'm = n', ['bar', 'baz'], Select::JOIN_OUTER);
     //         $sqlPrep12 = // same
     //         $sqlStr12 = 'SELECT `foo`.*, `zac`.`bar` AS `bar`, `zac`.`baz` AS `baz` FROM `foo` OUTER JOIN `zac` ON `m` = `n`';
     //         $internalTests12 = array(
     //             'processSelect' => array(array(array('`foo`.*'), array('`zac`.`bar`', '`bar`'), array('`zac`.`baz`', '`baz`')), '`foo`'),
     //             'processJoins'   => array(array(array('OUTER', '`zac`', '`m` = `n`')))
     //         );
     //         // join with column aliases
     //         $select13 = new Select;
     //         $select13->from('foo')->join('zac', 'm = n', array('BAR' => 'bar', 'BAZ' => 'baz'));
     //         $sqlPrep13 = // same
     //         $sqlStr13 = 'SELECT `foo`.*, `zac`.`bar` AS `BAR`, `zac`.`baz` AS `BAZ` FROM `foo` INNER JOIN `zac` ON `m` = `n`';
     //         $internalTests13 = array(
     //             'processSelect' => array(array(array('`foo`.*'), array('`zac`.`bar`', '`BAR`'), array('`zac`.`baz`', '`BAZ`')), '`foo`'),
     //             'processJoins'   => array(array(array('INNER', '`zac`', '`m` = `n`')))
     //         );
     //         // join with table aliases
     //         $select14 = new Select;
     //         $select14->from('foo')->join(array('b' => 'bar'), 'b.foo_id = foo.foo_id');
     //         $sqlPrep14 = // same
     //         $sqlStr14 = 'SELECT `foo`.*, `b`.* FROM `foo` INNER JOIN `bar` AS `b` ON `b`.`foo_id` = `foo`.`foo_id`';
     //         $internalTests14 = array(
     //             'processSelect' => array(array(array('`foo`.*'), array('`b`.*')), '`foo`'),
     //             'processJoins' => array(array(array('INNER', '`bar` AS `b`', '`b`.`foo_id` = `foo`.`foo_id`')))
     //         );
     // where (simple string)
     $select15 = new Select();
     $select15->from('foo')->where('c1 = 5');
     $sqlPrep15 = $sqlStr15 = 'SELECT * FROM `foo` WHERE c1 = 5';
     $internalTests15 = ['processSelect' => [[['*']], '`foo`'], 'processWhere' => ['c1 = 5']];
     // where (returning parameters)
     $select16 = new Select();
     $select16->from('bar')->where(['x = ?' => 5]);
     $sqlPrep16 = 'SELECT * FROM `bar` WHERE x = ?';
     $sqlStr16 = 'SELECT * FROM `bar` WHERE x = 5';
     $params16 = ['where1' => 5];
     $internalTests16 = ['processSelect' => [[['*']], '`bar`'], 'processWhere' => ['x = ?']];
     // group
     $select17 = new Select();
     $select17->from('foo')->group(['c1', 'c2']);
     $sqlPrep17 = $sqlStr17 = 'SELECT * FROM `foo` GROUP BY `c1`, `c2`';
     $internalTests17 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`c1`', '`c2`']]];
     $select18 = new Select();
     $select18->from('foo')->group('c1')->group('c2');
     $sqlPrep18 = $sqlStr18 = 'SELECT * FROM `foo` GROUP BY `c1`, `c2`';
     $internalTests18 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`c1`', '`c2`']]];
     $select19 = new Select();
     $select19->from('foo')->group(new Expression('DAY(?)', ['c1'], [Expression::TYPE_IDENTIFIER]));
     $sqlPrep19 = $sqlStr19 = 'SELECT * FROM `foo` GROUP BY DAY(`c1`)';
     $internalTests19 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['DAY(`c1`)']]];
     // having (simple string)
     $select20 = new Select();
     $select20->from('foo')->group('c1')->having('baz = 0');
     $sqlPrep20 = $sqlStr20 = 'SELECT * FROM `foo` GROUP BY `c1` HAVING baz = 0';
     $internalTests20 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`c1`']], 'processHaving' => ['baz = 0']];
     // having (returning parameters)
     $select21 = new Select();
     $select21->from('foo')->group('c1')->having(['baz = ?' => 5]);
     $sqlPrep21 = 'SELECT * FROM `foo` GROUP BY `c1` HAVING baz = ?';
     $sqlStr21 = 'SELECT * FROM `foo` GROUP BY `c1` HAVING baz = 5';
     $params21 = ['having1' => 5];
     $internalTests21 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`c1`']], 'processHaving' => ['baz = ?']];
     // order
     $select22 = new Select();
     $select22->from('foo')->order('c1');
     $sqlPrep22 = $sqlStr22 = 'SELECT * FROM `foo` ORDER BY `c1` ASC';
     $internalTests22 = ['processSelect' => [[['*']], '`foo`'], 'processOrder' => [[['`c1`', Select::ORDER_ASCENDING]]]];
     $select23 = new Select();
     $select23->from('foo')->order(['c1', 'c2']);
     $sqlPrep23 = $sqlStr23 = 'SELECT * FROM `foo` ORDER BY `c1` ASC, `c2` ASC';
     $internalTests23 = ['processSelect' => [[['*']], '`foo`'], 'processOrder' => [[['`c1`', Select::ORDER_ASCENDING], ['`c2`', Select::ORDER_ASCENDING]]]];
     $select24 = new Select();
     $select24->from('foo')->order(['c1' => 'DESC', 'c2' => 'Asc']);
     // notice partially lower case ASC
     $sqlPrep24 = $sqlStr24 = 'SELECT * FROM `foo` ORDER BY `c1` DESC, `c2` ASC';
     $internalTests24 = ['processSelect' => [[['*']], '`foo`'], 'processOrder' => [[['`c1`', Select::ORDER_DESCENDING], ['`c2`', Select::ORDER_ASCENDING]]]];
     $select25 = new Select();
     $select25->from('foo')->order(['c1' => 'asc'])->order('c2 desc');
     // notice partially lower case ASC
     $sqlPrep25 = $sqlStr25 = 'SELECT * FROM `foo` ORDER BY `c1` ASC, `c2` DESC';
     $internalTests25 = ['processSelect' => [[['*']], '`foo`'], 'processOrder' => [[['`c1`', Select::ORDER_ASCENDING], ['`c2`', Select::ORDER_DESCENDING]]]];
     // limit
     $select26 = new Select();
     $select26->from('foo')->limit(5);
     $sqlPrep26 = 'SELECT * FROM `foo` LIMIT ?,?';
     $sqlStr26 = 'SELECT * FROM `foo` LIMIT 0,5';
     $params26 = ['limit' => 5, 'offset' => 0];
     $internalTests26 = ['processSelect' => [[['*']], '`foo`'], 'processLimitOffset' => ['?', '?']];
     // limit with offset
     $select27 = new Select();
     $select27->from('foo')->limit(5)->offset(10);
     $sqlPrep27 = 'SELECT * FROM `foo` LIMIT ?,?';
     $sqlStr27 = 'SELECT * FROM `foo` LIMIT 10,5';
     $params27 = ['limit' => 5, 'offset' => 10];
     $internalTests27 = ['processSelect' => [[['*']], '`foo`'], 'processLimitOffset' => ['?', '?']];
     //         // joins with a few keywords in the on clause
     //         $select28 = new Select;
     //         $select28->from('foo')->join('zac', '(m = n AND c.x) BETWEEN x AND y.z OR (c.x < y.z AND c.x <= y.z AND c.x > y.z AND c.x >= y.z)');
     //         $sqlPrep28 = // same
     //         $sqlStr28 = 'SELECT `foo`.*, `zac`.* FROM `foo` INNER JOIN `zac` ON (`m` = `n` AND `c`.`x`) BETWEEN `x` AND `y`.`z` OR (`c`.`x` < `y`.`z` AND `c`.`x` <= `y`.`z` AND `c`.`x` > `y`.`z` AND `c`.`x` >= `y`.`z`)';
     //         $internalTests28 = array(
     //             'processSelect' => array(array(array('`foo`.*'), array('`zac`.*')), '`foo`'),
     //             'processJoins'  => array(array(array('INNER', '`zac`', '(`m` = `n` AND `c`.`x`) BETWEEN `x` AND `y`.`z` OR (`c`.`x` < `y`.`z` AND `c`.`x` <= `y`.`z` AND `c`.`x` > `y`.`z` AND `c`.`x` >= `y`.`z`)')))
     //         );
     //         // order with compound name
     //         $select29 = new Select;
     //         $select29->from('foo')->order('c1.d2');
     //         $sqlPrep29 = //
     //         $sqlStr29 = 'SELECT `foo`.* FROM `foo` ORDER BY `c1`.`d2` ASC';
     //         $internalTests29 = array(
     //             'processSelect' => array(array(array('`foo`.*')), '`foo`'),
     //             'processOrder'  => array(array(array('`c1`.`d2`', Select::ORDER_ASCENDING)))
     //         );
     //         // group with compound name
     //         $select30 = new Select;
     //         $select30->from('foo')->group('c1.d2');
     //         $sqlPrep30 = // same
     //         $sqlStr30 = 'SELECT `foo`.* FROM `foo` GROUP BY `c1`.`d2`';
     //         $internalTests30 = array(
     //             'processSelect' => array(array(array('`foo`.*')), '`foo`'),
     //             'processGroup'  => array(array('`c1`.`d2`'))
     //         );
     //         // join with expression in ON part
     //         $select31 = new Select;
     //         $select31->from('foo')->join('zac', new Expression('(m = n AND c.x) BETWEEN x AND y.z'));
     //         $sqlPrep31 = // same
     //         $sqlStr31 = 'SELECT `foo`.*, `zac`.* FROM `foo` INNER JOIN `zac` ON (m = n AND c.x) BETWEEN x AND y.z';
     //         $internalTests31 = array(
     //             'processSelect' => array(array(array('`foo`.*'), array('`zac`.*')), '`foo`'),
     //             'processJoins'   => array(array(array('INNER', '`zac`', '(m = n AND c.x) BETWEEN x AND y.z')))
     //         );
     $select32subselect = new Select();
     $select32subselect->from('bar')->where(['y' => 1]);
     $select32 = new Select();
     $select32->from($select32subselect)->order('x');
     $sqlPrep32 = 'SELECT * FROM (SELECT * FROM `bar` WHERE `y` = ?) ORDER BY `x` ASC';
     $sqlStr32 = 'SELECT * FROM (SELECT * FROM `bar` WHERE `y` = 1) ORDER BY `x` ASC';
     $internalTests32 = ['processSelect' => [[['*']], '(SELECT * FROM `bar` WHERE `y` = ?)']];
     // not yet supported by Sphinx
     $select33 = new Select();
     $select33->from('foo')->columns(['*'])->where(['c1' => null, 'c2' => [1, 2, 3], new \Zend\Db\Sql\Predicate\IsNotNull('c3')]);
     $sqlPrep33 = 'SELECT * FROM `foo` WHERE `c1` IS NULL AND `c2` IN (?, ?, ?) AND `c3` IS NOT NULL';
     $sqlStr33 = 'SELECT * FROM `foo` WHERE `c1` IS NULL AND `c2` IN (1, 2, 3) AND `c3` IS NOT NULL';
     $internalTests33 = ['processSelect' => [[['*']], '`foo`'], 'processWhere' => ['`c1` IS NULL AND `c2` IN (?, ?, ?) AND `c3` IS NOT NULL']];
     // not yet supported by Sphinx
     // @author Demian Katz
     $select34 = new Select();
     $select34->from('foo')->order([new Expression('isnull(?) DESC', ['name'], [Expression::TYPE_IDENTIFIER]), 'name']);
     $sqlPrep34 = 'SELECT * FROM `foo` ORDER BY isnull(`name`) DESC, `name` ASC';
     $sqlStr34 = 'SELECT * FROM `foo` ORDER BY isnull(`name`) DESC, `name` ASC';
     $internalTests34 = ['processOrder' => [[['isnull(`name`) DESC'], ['`name`', Select::ORDER_ASCENDING]]]];
     //         // join with Expression object in COLUMNS part (ZF2-514)
     //         // @co-author Koen Pieters (kpieters)
     //         $select35 = new Select;
     //         $select35->from('foo')->columns(array())->join('bar', 'm = n', array('thecount' => new Expression(`COUNT(*)`)));
     //         $sqlPrep35 = // same
     //         $sqlStr35 = 'SELECT COUNT(*) AS `thecount` FROM `foo` INNER JOIN `bar` ON `m` = `n`';
     //         $internalTests35 = array(
     //             'processSelect' => array(array(array('COUNT(*)', '`thecount`')), '`foo`'),
     //             'processJoins'   => array(array(array('INNER', '`bar`', '`m` = `n`')))
     //         );
     //         // multiple joins with expressions
     //         // reported by @jdolieslager
     //         $select36 = new Select;
     //         $select36->from('foo')
     //         ->join('tableA', new Predicate\Operator('id', '=', 1))
     //         ->join('tableB', new Predicate\Operator('id', '=', 2))
     //         ->join('tableC', new Predicate\PredicateSet(array(
     //             new Predicate\Operator('id', '=', 3),
     //             new Predicate\Operator('number', '>', 20)
     //         )));
     //         $sqlPrep36 = 'SELECT `foo`.*, `tableA`.*, `tableB`.*, `tableC`.* FROM `foo`'
     //             . ' INNER JOIN `tableA` ON `id` = :join1part1 INNER JOIN `tableB` ON `id` = :join2part1 '
     //                 . 'INNER JOIN `tableC` ON `id` = :join3part1 AND `number` > :join3part2';
     //         $sqlStr36 = 'SELECT `foo`.*, `tableA`.*, `tableB`.*, `tableC`.* FROM `foo` '
     //             . 'INNER JOIN `tableA` ON `id` = \'1\' INNER JOIN `tableB` ON `id` = \'2\' '
     //                 . 'INNER JOIN `tableC` ON `id` = \'3\' AND `number` > \'20\'';
     //         $internalTests36 = array();
     //         $useNamedParams36 = true;
     /**
      * @author robertbasic
      * @link https://github.com/zendframework/zf2/pull/2714
      */
     $select37 = new Select();
     $select37->from('foo')->columns(['bar'], false);
     $sqlPrep37 = $sqlStr37 = 'SELECT `bar` FROM `foo`';
     $internalTests37 = ['processSelect' => [[['`bar`']], '`foo`']];
     //         // @link https://github.com/zendframework/zf2/issues/3294
     //         // Test TableIdentifier In Joins
     //         $select38 = new Select;
     //         $select38->from('foo')->columns(array())->join(new TableIdentifier('bar', 'baz'), 'm = n', array('thecount' => new Expression(`COUNT(*)`)));
     //         $sqlPrep38 = // same
     //         $sqlStr38 = 'SELECT COUNT(*) AS `thecount` FROM `foo` INNER JOIN `baz`.`bar` ON `m` = `n`';
     //         $internalTests38 = array(
     //             'processSelect' => array(array(array('COUNT(*)', '`thecount`')), '`foo`'),
     //             'processJoins'   => array(array(array('INNER', '`baz`.`bar`', '`m` = `n`')))
     //         );
     //         // subselect in join
     //         $select39subselect = new Select;
     //         $select39subselect->from('bar')->where->like('y', '%Foo%');
     //         $select39 = new Select;
     //         $select39->from('foo')->join(array('z' => $select39subselect), 'z.foo = bar.id');
     //         $sqlPrep39 = 'SELECT `foo`.*, `z`.* FROM `foo` INNER JOIN (SELECT `bar`.* FROM `bar` WHERE `y` LIKE ?) AS `z` ON `z`.`foo` = `bar`.`id`';
     //         $sqlStr39 = 'SELECT `foo`.*, `z`.* FROM `foo` INNER JOIN (SELECT `bar`.* FROM `bar` WHERE `y` LIKE \'%Foo%\') AS `z` ON `z`.`foo` = `bar`.`id`';
     //         $internalTests39 = array(
     //             'processJoins' => array(array(array('INNER', '(SELECT `bar`.* FROM `bar` WHERE `y` LIKE ?) AS `z`', '`z`.`foo` = `bar`.`id`')))
     //         );
     //         // @link https://github.com/zendframework/zf2/issues/3294
     //         // Test TableIdentifier In Joins, with multiple joins
     //         $select40 = new Select;
     //         $select40->from('foo')
     //         ->join(array('a' => new TableIdentifier('another_foo', 'another_schema')), 'a.x = foo.foo_column')
     //         ->join('bar', 'foo.colx = bar.colx');
     //         $sqlPrep40 = // same
     //         $sqlStr40 = 'SELECT `foo`.*, `a`.*, `bar`.* FROM `foo`'
     //             . ' INNER JOIN `another_schema`.`another_foo` AS `a` ON `a`.`x` = `foo`.`foo_column`'
     //                 . ' INNER JOIN `bar` ON `foo`.`colx` = `bar`.`colx`';
     //         $internalTests40 = array(
     //             'processSelect' => array(array(array('`foo`.*'), array('`a`.*'), array('`bar`.*')), '`foo`'),
     //             'processJoins'  => array(array(
     //                 array('INNER', '`another_schema`.`another_foo` AS `a`', '`a`.`x` = `foo`.`foo_column`'),
     //                 array('INNER', '`bar`', '`foo`.`colx` = `bar`.`colx`')
     //             ))
     //         );
     //test quantifier (silent ignore)
     $select41 = new Select();
     $select41->from('foo')->quantifier(Select::QUANTIFIER_DISTINCT);
     $sqlPrep41 = $sqlStr41 = 'SELECT * FROM `foo`';
     $internalTests41 = ['processSelect' => [[['*']], '`foo`']];
     $select42 = new Select();
     $select42->from('foo')->quantifier(new Expression('TOP ?', [10]));
     $sqlPrep42 = $sqlStr42 = 'SELECT * FROM `foo`';
     $internalTests42 = ['processSelect' => [[['*']], '`foo`']];
     //test table alias (silent ignore)
     $select43 = new Select();
     $select43->from(['x' => 'foo'])->columns(['bar'], false);
     $sqlPrep43 = $sqlStr43 = 'SELECT `bar` FROM `foo`';
     $internalTests43 = ['processSelect' => [[['`bar`']], '`foo`']];
     //test combine (silent ignore)
     $select44 = new Select();
     $select44->from('foo');
     $select44b = new Select();
     $select44b->from('bar')->where('c = d');
     $select44->combine($select44b, Select::COMBINE_UNION, 'ALL');
     $sqlPrep44 = $sqlStr44 = 'SELECT * FROM `foo`';
     $internalTests44 = ['processSelect' => [[['*']], '`foo`']];
     // limit with offset
     $select45 = new Select();
     $select45->from('foo')->limit("5")->offset("10");
     $sqlPrep45 = 'SELECT * FROM `foo` LIMIT ?,?';
     $sqlStr45 = 'SELECT * FROM `foo` LIMIT 10,5';
     $params45 = ['limit' => 5, 'offset' => 10];
     $internalTests45 = ['processSelect' => [[['*']], '`foo`'], 'processLimitOffset' => ['?', '?']];
     // within group order
     $select46 = new Select();
     $select46->from('foo')->group('baz')->withinGroupOrder('c1');
     $sqlPrep46 = $sqlStr46 = 'SELECT * FROM `foo` GROUP BY `baz` WITHIN GROUP ORDER BY `c1` ASC';
     $internalTests46 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`baz`']], 'processWithinGroupOrder' => [[['`c1`', Select::ORDER_ASCENDING]]]];
     $select47 = new Select();
     $select47->from('foo')->group('baz')->withinGroupOrder(['c1', 'c2']);
     $sqlPrep47 = $sqlStr47 = 'SELECT * FROM `foo` GROUP BY `baz` WITHIN GROUP ORDER BY `c1` ASC, `c2` ASC';
     $internalTests47 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`baz`']], 'processWithinGroupOrder' => [[['`c1`', Select::ORDER_ASCENDING], ['`c2`', Select::ORDER_ASCENDING]]]];
     $select48 = new Select();
     $select48->from('foo')->group('baz')->withinGroupOrder(['c1' => 'DESC', 'c2' => 'Asc']);
     // notice partially lower case ASC
     $sqlPrep48 = $sqlStr48 = 'SELECT * FROM `foo` GROUP BY `baz` WITHIN GROUP ORDER BY `c1` DESC, `c2` ASC';
     $internalTests48 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`baz`']], 'processWithinGroupOrder' => [[['`c1`', Select::ORDER_DESCENDING], ['`c2`', Select::ORDER_ASCENDING]]]];
     $select49 = new Select();
     //testing all features for code coverage (i.e. Sphinx doesn't support Expression in order yet)
     $select49->from('foo')->group('baz')->withinGroupOrder(['c1' => 'asc'])->withinGroupOrder('c2 desc')->withinGroupOrder(['c3', 'baz DESC'])->withinGroupOrder(new Expression('RAND()'));
     $sqlPrep49 = $sqlStr49 = 'SELECT * FROM `foo` GROUP BY `baz` WITHIN GROUP ORDER BY `c1` ASC, `c2` DESC, `c3` ASC, `baz` DESC, RAND()';
     $internalTests49 = ['processSelect' => [[['*']], '`foo`'], 'processGroup' => [['`baz`']], 'processWithinGroupOrder' => [[['`c1`', Select::ORDER_ASCENDING], ['`c2`', Select::ORDER_DESCENDING], ['`c3`', Select::ORDER_ASCENDING], ['`baz`', Select::ORDER_DESCENDING], ['RAND()']]]];
     // option
     $select50 = new Select();
     $select50->from('foo')->option(['ranker' => 'bm25', 'max_matches' => 500, 'field_weights' => new Expression('(title=10, body=3)')]);
     $sqlPrep50 = 'SELECT * FROM `foo` OPTION `ranker` = ?, `max_matches` = ?, `field_weights` = (title=10, body=3)';
     $sqlStr50 = 'SELECT * FROM `foo` OPTION `ranker` = \'bm25\', `max_matches` = 500, `field_weights` = (title=10, body=3)';
     $internalTests50 = ['processSelect' => [[['*']], '`foo`'], 'processOption' => [[['`ranker`', '?'], ['`max_matches`', '?'], ['`field_weights`', '(title=10, body=3)']]]];
     /**
      * $select = the select object
      * $sqlPrep = the sql as a result of preparation
      * $params = the param container contents result of preparation
      * $sqlStr = the sql as a result of getting a string back
      * $internalTests what the internal functions should return (safe-guarding extension)
      */
     return [[$select0, $sqlPrep0, [], $sqlStr0, $internalTests0], [$select1, $sqlPrep1, [], $sqlStr1, $internalTests1], [$select2, $sqlPrep2, [], $sqlStr2, $internalTests2], [$select3, $sqlPrep3, [], $sqlStr3, $internalTests3], [$select4, $sqlPrep4, [], $sqlStr4, $internalTests4], [$select5, $sqlPrep5, [], $sqlStr5, $internalTests5], [$select6, $sqlPrep6, [], $sqlStr6, $internalTests6], [$select7, $sqlPrep7, [], $sqlStr7, $internalTests7], [$select8, $sqlPrep8, [], $sqlStr8, $internalTests8], [$select9, $sqlPrep9, $params9, $sqlStr9, $internalTests9], [$select10, $sqlPrep10, [], $sqlStr10, $internalTests10], [$select11, $sqlPrep11, [], $sqlStr11, $internalTests11], [$select12, $sqlPrep12, [], $sqlStr12, $internalTests12], [$select15, $sqlPrep15, [], $sqlStr15, $internalTests15], [$select16, $sqlPrep16, $params16, $sqlStr16, $internalTests16], [$select17, $sqlPrep17, [], $sqlStr17, $internalTests17], [$select18, $sqlPrep18, [], $sqlStr18, $internalTests18], [$select19, $sqlPrep19, [], $sqlStr19, $internalTests19], [$select20, $sqlPrep20, [], $sqlStr20, $internalTests20], [$select21, $sqlPrep21, $params21, $sqlStr21, $internalTests21], [$select22, $sqlPrep22, [], $sqlStr22, $internalTests22], [$select23, $sqlPrep23, [], $sqlStr23, $internalTests23], [$select24, $sqlPrep24, [], $sqlStr24, $internalTests24], [$select25, $sqlPrep25, [], $sqlStr25, $internalTests25], [$select26, $sqlPrep26, $params26, $sqlStr26, $internalTests26], [$select27, $sqlPrep27, $params27, $sqlStr27, $internalTests27], [$select32, $sqlPrep32, [], $sqlStr32, $internalTests32], [$select33, $sqlPrep33, [], $sqlStr33, $internalTests33], [$select34, $sqlPrep34, [], $sqlStr34, $internalTests34], [$select37, $sqlPrep37, [], $sqlStr37, $internalTests37], [$select41, $sqlPrep41, [], $sqlStr41, $internalTests41], [$select42, $sqlPrep42, [], $sqlStr42, $internalTests42], [$select43, $sqlPrep43, [], $sqlStr43, $internalTests43], [$select44, $sqlPrep44, [], $sqlStr44, $internalTests44], [$select45, $sqlPrep45, $params45, $sqlStr45, $internalTests45], [$select46, $sqlPrep46, [], $sqlStr46, $internalTests46], [$select47, $sqlPrep47, [], $sqlStr47, $internalTests47], [$select48, $sqlPrep48, [], $sqlStr48, $internalTests48], [$select49, $sqlPrep49, [], $sqlStr49, $internalTests49], [$select50, $sqlPrep50, [], $sqlStr50, $internalTests50]];
 }