From 67065b108c1826b64ae79c8629b6245b84fe6127 Mon Sep 17 00:00:00 2001 From: "robert.kubac" Date: Wed, 24 Aug 2022 10:48:15 +0200 Subject: [PATCH] fix #365 --- src/PHPSQLParser/processors/ColumnDefinitionProcessor.php | 1 - tests/cases/parser/issue320Test.php | 5 ++--- tests/cases/parser/issue335Test.php | 2 +- tests/cases/parser/issue355Test.php | 5 ++--- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php b/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php index d2d29e59..ac4400e1 100644 --- a/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php +++ b/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php @@ -187,7 +187,6 @@ public function process($tokens) { continue 2; case 'CHAR': - case 'CHARACTER': // Alias for CHAR $expr[] = array('expr_type' => ExpressionType::DATA_TYPE, 'base_expr' => $trim, 'length' => false); $currCategory = 'SINGLE_PARAM_PARENTHESIS'; $prevCategory = 'TEXT'; diff --git a/tests/cases/parser/issue320Test.php b/tests/cases/parser/issue320Test.php index 1f3b274e..eabb00a8 100644 --- a/tests/cases/parser/issue320Test.php +++ b/tests/cases/parser/issue320Test.php @@ -39,9 +39,8 @@ */ namespace PHPSQLParser\Test\Parser; use PHPSQLParser\PHPSQLParser; -use PHPSQLParser\PHPSQLCreator; -class issue320Test extends \PHPUnit_Framework_TestCase +class issue320Test extends \PHPUnit\Framework\TestCase { public function test_no_warning_is_issued_when_help_table_is_used() { @@ -51,7 +50,7 @@ public function test_no_warning_is_issued_when_help_table_is_used() // there currently is an exception because `HELP` is a keyword // but this query seems valid at least in mysql and mssql // so ideally PHPSQLParser would be able to parse it - $this->setExpectedException( + $this->expectException( '\PHPSQLParser\exceptions\UnableToCalculatePositionException' ); diff --git a/tests/cases/parser/issue335Test.php b/tests/cases/parser/issue335Test.php index 7dd5a869..90bf3b9c 100644 --- a/tests/cases/parser/issue335Test.php +++ b/tests/cases/parser/issue335Test.php @@ -39,7 +39,7 @@ use PHPSQLParser\PHPSQLParser; -class issue335Test extends \PHPUnit_Framework_TestCase +class issue335Test extends \PHPUnit\Framework\TestCase { /** * @test diff --git a/tests/cases/parser/issue355Test.php b/tests/cases/parser/issue355Test.php index f2178a75..ebf035cf 100644 --- a/tests/cases/parser/issue355Test.php +++ b/tests/cases/parser/issue355Test.php @@ -11,7 +11,6 @@ public function testIssue322() $sql = " CREATE TABLE `test_alias` ( `a` INTEGER, - `b` CHARACTER(10), `c` VARCHARACTER(10), `d` INT2, `e` INT3, @@ -24,9 +23,9 @@ public function testIssue322() "; $parser = new PHPSQLParser(); $parser->parse($sql, true); - // We expect to see 10 parsed columns + // We expect to see 9 parsed columns $this->assertEquals( - 10, + 9, count($parser->parsed['TABLE']['create-def']['sub_tree']) );