diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Lexer/LexerTest.php | 26 | ||||
-rw-r--r-- | tests/Parser/ParserTest.php | 24 | ||||
-rw-r--r-- | tests/bootstrap.php | 7 |
3 files changed, 12 insertions, 45 deletions
diff --git a/tests/Lexer/LexerTest.php b/tests/Lexer/LexerTest.php index 8a7798c..286a1f9 100644 --- a/tests/Lexer/LexerTest.php +++ b/tests/Lexer/LexerTest.php @@ -18,8 +18,10 @@ class LexerTest extends TestCase { $lexer = new Lexer(''); - $lexer->error('error #1', 'foo', 1, array(), 2); - $lexer->error('%2$s #%1$d', 'bar', 3, array(2, 'error'), 4); + $lexer->error(__('error #1'), 'foo', 1, 2); + $lexer->error( + sprintf(__('%2$s #%1$d'), 2, 'error'), 'bar', 3, 4 + ); $this->assertEquals( $lexer->errors, @@ -31,24 +33,6 @@ class LexerTest extends TestCase } /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testErrorTranslate() - { - define('TRANSLATE', '\\SqlParser\\Tests\\translate'); - - $lexer = new Lexer(''); - - $lexer->error('TO_TRANSLATE', null); - - $this->assertEquals( - $lexer->errors, - array(new LexerException('***', null, 0)) - ); - } - - /** * @expectedException SqlParser\Exceptions\LexerException * @expectedExceptionMessage strict error * @expectedExceptionCode 4 @@ -58,7 +42,7 @@ class LexerTest extends TestCase $lexer = new Lexer(''); $lexer->strict = true; - $lexer->error('strict error', 'foo', 1, array(), 4); + $lexer->error(__('strict error'), 'foo', 1, 4); } /** diff --git a/tests/Parser/ParserTest.php b/tests/Parser/ParserTest.php index 1cd5e2d..0193090 100644 --- a/tests/Parser/ParserTest.php +++ b/tests/Parser/ParserTest.php @@ -43,8 +43,8 @@ class ParserTest extends TestCase { $parser = new Parser(new TokensList()); - $parser->error('error #1', new Token('foo'), array(), 1); - $parser->error('%2$s #%1$d', new Token('bar'), array(2, 'error'), 2); + $parser->error(__('error #1'), new Token('foo'), 1); + $parser->error(sprintf(__('%2$s #%1$d'), 2, 'error'), new Token('bar'), 2); $this->assertEquals( $parser->errors, @@ -56,24 +56,6 @@ class ParserTest extends TestCase } /** - * @runInSeparateProcess - * @preserveGlobalState disabled - */ - public function testErrorTranslate() - { - define('TRANSLATE', '\\SqlParser\\Tests\\translate'); - - $parser = new Parser(new TokensList()); - - $parser->error('TO_TRANSLATE', null); - - $this->assertEquals( - $parser->errors, - array(new ParserException('***', null, 0)) - ); - } - - /** * @expectedException SqlParser\Exceptions\ParserException * @expectedExceptionMessage strict error * @expectedExceptionCode 3 @@ -83,6 +65,6 @@ class ParserTest extends TestCase $parser = new Parser(new TokensList()); $parser->strict = true; - $parser->error('strict error', new Token('foo'), array(), 3); + $parser->error(__('strict error'), new Token('foo'), 3); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index d23d71f..6eff906 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -13,12 +13,13 @@ use SqlParser\Token; * * It translates only "TO_TRANSLATE" to "***". * - * @param string $msg + * @param string $msg * * @return string */ -function translate($msg) { - return str_replace('TO_TRANSLATE', '***' , $msg); +function __($msg) +{ + return str_replace('TO_TRANSLATE', '***', $msg); } /** |