szurubooru/tests/PDOEx/UpdateQueryTest.php

22 lines
593 B
PHP
Raw Normal View History

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