summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDan Ungureanu <udan1107@gmail.com>2015-08-18 02:24:42 +0300
committerDan Ungureanu <udan1107@gmail.com>2015-08-18 02:24:42 +0300
commit14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18 (patch)
treea4604f6b1d1095790e313b71bf226e4291788ca8 /tests
parent1568adba1af7bf061354a30afd169e29fa43f133 (diff)
downloadsql-parser-14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18.zip
sql-parser-14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18.tar.gz
sql-parser-14c54da98c3b4f18c78ff44c22fbdd20e8ef6e18.tar.bz2
Replaced explicit calls to Component::build() with implicit calls to Component::__toString().
Fixed bugs that caused field names like '0', '0.0', etc. to be considered invalid. Refactoring.
Diffstat (limited to 'tests')
-rw-r--r--tests/Components/CreateDefinitionTest.php2
-rw-r--r--tests/Components/ExpressionTest.php10
2 files changed, 9 insertions, 3 deletions
diff --git a/tests/Components/CreateDefinitionTest.php b/tests/Components/CreateDefinitionTest.php
index 81c8ba8..a7b7f86 100644
--- a/tests/Components/CreateDefinitionTest.php
+++ b/tests/Components/CreateDefinitionTest.php
@@ -19,7 +19,7 @@ class CreateDefinitionTest extends TestCase
$this->assertEquals('str', $component[0]->name);
$this->assertEquals('FULLTEXT INDEX', $component[1]->key->type);
$this->assertEquals('indx', $component[1]->key->name);
- $this->assertEquals('FULLTEXT INDEX `indx` (`str`)', $component[1]);
+ $this->assertEquals('FULLTEXT INDEX `indx` (`str`)', (string) $component[1]);
}
public function testParseErr1()
diff --git a/tests/Components/ExpressionTest.php b/tests/Components/ExpressionTest.php
index 01492fd..863d914 100644
--- a/tests/Components/ExpressionTest.php
+++ b/tests/Components/ExpressionTest.php
@@ -60,7 +60,13 @@ class ExpressionTest extends TestCase
public function testBuild()
{
- $component = new Expression('1 + 2', 'three');
- $this->assertEquals(Expression::build($component), '1 + 2 AS `three`');
+ $component = array(
+ new Expression('1 + 2', 'three'),
+ new Expression('1 + 3', 'four')
+ );
+ $this->assertEquals(
+ Expression::build($component),
+ '1 + 2 AS `three`, 1 + 3 AS `four`'
+ );
}
}