112 lines
4.0 KiB
PHP
112 lines
4.0 KiB
PHP
<?php
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/smarty/libs/Smarty.class.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.xmlform.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.xmlDocument.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.form.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.dbconnection.php';
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/propel/Propel.php';
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/creole/Creole.php';
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/pear/PEAR.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.phpSqlParser.php';
|
|
|
|
/**
|
|
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:23.
|
|
*/
|
|
|
|
class classPHPSQLParserTest extends PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @var PHPSQLParser
|
|
*/
|
|
protected $object;
|
|
|
|
/**
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
* This method is called before a test is executed.
|
|
*/
|
|
protected function setUp()
|
|
{
|
|
$this->object = new PHPSQLParser();
|
|
}
|
|
|
|
/**
|
|
* Tears down the fixture, for example, closes a network connection.
|
|
* This method is called after a test is executed.
|
|
*/
|
|
protected function tearDown()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* This is the default method to test, if the class still having
|
|
* the same number of methods.
|
|
*/
|
|
public function testNumberOfMethodsInThisClass()
|
|
{
|
|
$methods = get_class_methods('PHPSQLParser'); $this->assertTrue( count($methods) == 4);
|
|
}
|
|
|
|
/**
|
|
* @covers PHPSQLParser::__construct
|
|
* @todo Implement test__construct().
|
|
*/
|
|
public function test__construct()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('__construct', $methods ), 'exists method __construct' );
|
|
$r = new ReflectionMethod('PHPSQLParser', '__construct');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'sql');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == true);
|
|
$this->assertTrue( $params[0]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers PHPSQLParser::parse
|
|
* @todo Implement testparse().
|
|
*/
|
|
public function testparse()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('parse', $methods ), 'exists method parse' );
|
|
$r = new ReflectionMethod('PHPSQLParser', 'parse');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'sql');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers PHPSQLParser::process_insert
|
|
* @todo Implement testprocess_insert().
|
|
*/
|
|
public function testprocess_insert()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('process_insert', $methods ), 'exists method process_insert' );
|
|
$r = new ReflectionMethod('PHPSQLParser', 'process_insert');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'tokens');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'token_category');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == 'INSERT');
|
|
}
|
|
|
|
/**
|
|
* @covers PHPSQLParser::load_reserved_words
|
|
* @todo Implement testload_reserved_words().
|
|
*/
|
|
public function testload_reserved_words()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('load_reserved_words', $methods ), 'exists method load_reserved_words' );
|
|
$r = new ReflectionMethod('PHPSQLParser', 'load_reserved_words');
|
|
$params = $r->getParameters();
|
|
}
|
|
|
|
}
|