/
AbstractQueryTest.php
44 lines (35 loc) · 1.12 KB
/
AbstractQueryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Aura\Sql\Query;
use Aura\Sql\ConnectionFactory;
use Aura\Sql\Query\Factory as QueryFactory;
abstract class AbstractQueryTest extends \PHPUnit_Framework_TestCase
{
protected $query_type;
protected $query;
protected $connection;
protected function setUp()
{
parent::setUp();
$connection_factory = new ConnectionFactory;
$query_factory = new QueryFactory;
$this->connection = $connection_factory->newInstance('sqlite', ':memory:');
$this->query = $query_factory->newInstance(
$this->query_type,
$this->connection
);
}
protected function tearDown()
{
parent::tearDown();
}
protected function assertSameSql($expect, $actual)
{
$expect = trim($expect);
$expect = preg_replace('/^\s*/m', '', $expect);
$expect = preg_replace('/\s*$/m', '', $expect);
$actual = trim($actual);
$actual = preg_replace('/^\s*/m', '', $actual);
$actual = preg_replace('/\s*$/m', '', $actual);
$this->assertSame($expect, $actual);
}
}