mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 01:28:47 +02:00
Parser for Short Hand Syntax: unit tests
SVN:b1312[5753]
This commit is contained in:
46
test/core/oql/OqlInterpreterTest.php
Normal file
46
test/core/oql/OqlInterpreterTest.php
Normal 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'"),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user