2023-06-28 20:18:22 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Illuminate\Tests\Database;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Connection;
|
|
|
|
|
use Illuminate\Database\Query\Grammars\SQLiteGrammar;
|
|
|
|
|
use Mockery as m;
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
class DatabaseSQLiteQueryGrammarTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
public function testToRawSql()
|
|
|
|
|
{
|
|
|
|
|
$connection = m::mock(Connection::class);
|
|
|
|
|
$connection->shouldReceive('escape')->with('foo', false)->andReturn("'foo'");
|
2025-02-12 20:00:57 +03:30
|
|
|
$grammar = new SQLiteGrammar($connection);
|
2023-06-28 20:18:22 +01:00
|
|
|
|
|
|
|
|
$query = $grammar->substituteBindingsIntoRawSql(
|
|
|
|
|
'select * from "users" where \'Hello\'\'World?\' IS NOT NULL AND "email" = ?',
|
|
|
|
|
['foo'],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->assertSame('select * from "users" where \'Hello\'\'World?\' IS NOT NULL AND "email" = \'foo\'', $query);
|
|
|
|
|
}
|
|
|
|
|
}
|