szuru/tests/PDOEx/InsertQueryTest.php

22 lines
609 B
PHP
Raw Permalink Normal View History

<?php
namespace Szurubooru\Tests\PDOEx;
use Szurubooru\PDOEx\InsertQuery;
use Szurubooru\PDOEx\PDOEx;
use Szurubooru\Tests\AbstractTestCase;
final class InsertQueryTest extends AbstractTestCase
{
2015-11-25 09:48:03 +01:00
public function testDefault()
{
$query = $this->getInsertQuery();
$query->values(['key1' => 'value', 'key2' => 'value2']);
$this->assertRegExp('/^INSERT INTO test \(key1, key2\) VALUES \(:\w*, :\w*\)$/', $query->getQuery());
}
2015-11-25 09:48:03 +01:00
private function getInsertQuery()
{
$pdoMock = $this->mock(PDOEx::class);
return new InsertQuery($pdoMock, 'test');
}
}