Parser for Short Hand Syntax: unit tests

SVN:b1312[5753]
This commit is contained in:
Eric Espié
2018-04-27 13:26:56 +00:00
parent 88ae239a56
commit d57fb3e24e

View File

@@ -0,0 +1,46 @@
<?php
/**
* Created by PhpStorm.
* User: Eric
* Date: 27/04/2018
* Time: 09:52
*/
namespace Combodo\iTop\Test\UnitTest\Core\Oql;
use OqlInterpreter;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
class OqlInterpreterTest extends ItopTestCase
{
/**
* @throws \Exception
*/
protected function setUp()
{
parent::setUp();
require_once(APPROOT.'/core/cmdbobject.class.inc.php');
require_once(APPROOT."core/oql/oqlinterpreter.class.inc.php");
}
/**
* @dataProvider ParseProvider
* @param $sQuery
*/
public function testParse($sQuery)
{
$oOql = new OqlInterpreter($sQuery);
$oTrash = $oOql->Parse(); // Not expecting a given format, otherwise use ParseExpression/ParseObjectQuery/ParseValueSetQuery
$this->debug($oTrash);
}
public function ParseProvider()
{
return array(
array("SELECT Contact WHERE org_id->deliverymodel_id->name = 'toto'"),
array("SELECT Contact WHERE cis_list->name = 'toto'"),
);
}
}