RedUNIT\Blackhole\Glue::testGlue PHP Метод

testGlue() публичный Метод

Tests whether we can intelligently glue together SQL snippets.
public testGlue ( ) : void
Результат void
    public function testGlue()
    {
        $writer = R::getWriter();
        //Can we add a condition without having to type 'WHERE' - usual suspects
        asrt($writer->glueSQLCondition(' name = ? '), ' WHERE  name = ? ');
        asrt($writer->glueSQLCondition(' value1 > ? OR value < ? '), ' WHERE  value1 > ? OR value < ? ');
        //Does it recognize NON-WHERE conditions? - usual suspects
        asrt($writer->glueSQLCondition(' ORDER BY name '), ' ORDER BY name ');
        asrt($writer->glueSQLCondition(' LIMIT 10 '), ' LIMIT 10 ');
        asrt($writer->glueSQLCondition(' OFFSET 20 '), ' OFFSET 20 ');
        //highly doubtful but who knows... - I think nobody will ever use this in a query snippet.
        asrt($writer->glueSQLCondition(' GROUP BY grp '), ' GROUP BY grp ');
        asrt($writer->glueSQLCondition(' HAVING x = ? '), ' HAVING x = ? ');
        //can we replace WHERE with AND ?
        asrt($writer->glueSQLCondition(' AND name = ? ', QueryWriter::C_GLUE_WHERE), ' WHERE  name = ? ');
        //can we glue with AND instead of WHERE ?
        asrt($writer->glueSQLCondition(' value1 > ? OR value < ? ', QueryWriter::C_GLUE_AND), ' AND  value1 > ? OR value < ? ');
        //non-cases
        asrt($writer->glueSQLCondition(' GROUP BY grp ', QueryWriter::C_GLUE_WHERE), ' GROUP BY grp ');
        asrt($writer->glueSQLCondition(' GROUP BY grp ', QueryWriter::C_GLUE_AND), ' GROUP BY grp ');
    }