Add classes and tests from common project
This commit is contained in:
26
tests/unit/Query/DeleteTest.php
Normal file
26
tests/unit/Query/DeleteTest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Test\Unit\Query;
|
||||
|
||||
use BitBadger\PDODocument\Field;
|
||||
use BitBadger\PDODocument\Query\Delete;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Unit tests for the Delete class
|
||||
*/
|
||||
class DeleteTest extends TestCase
|
||||
{
|
||||
public function testByIdSucceeds(): void
|
||||
{
|
||||
$this->assertEquals("DELETE FROM over_there WHERE data->>'id' = @id", Delete::byId('over_there'),
|
||||
'DELETE statement not constructed correctly');
|
||||
}
|
||||
|
||||
public function testByFieldsSucceeds(): void
|
||||
{
|
||||
$this->assertEquals("DELETE FROM my_table WHERE data->>'value' < @max AND data->>'value' >= @min",
|
||||
Delete::byFields('my_table', [Field::LT('value', 99, '@max'), Field::GE('value', 18, '@min')]),
|
||||
'DELETE statement not constructed correctly');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user