mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-23 06:24:53 +00:00
All test for constraint violation exception
This commit is contained in:
parent
5ba38fc7aa
commit
7f7d0cd1e7
1 changed files with 11 additions and 3 deletions
|
@ -58,9 +58,17 @@ class TestDbStatementSQLite3 extends \PHPUnit\Framework\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBindWithoutType() {
|
function testBindWithoutType() {
|
||||||
$this->assertException("paramTypeMissing", "Db");
|
$nativeStatement = $this->c->prepare("SELECT ? as value");
|
||||||
$nativeStatement = $this->c->prepare("SELECT ? as value");
|
$this->assertException("paramTypeMissing", "Db");
|
||||||
$s = new self::$imp($this->c, $nativeStatement, []);
|
$s = new self::$imp($this->c, $nativeStatement, []);
|
||||||
$val = $s->runArray([1])->get();
|
$s->runArray([1])->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testViolateConstraint() {
|
||||||
|
$this->c->exec("CREATE TABLE test(id integer not null)");
|
||||||
|
$nativeStatement = $this->c->prepare("INSERT INTO test(id) values(?)");
|
||||||
|
$s = new self::$imp($this->c, $nativeStatement, ["int"]);
|
||||||
|
$this->assertException("constraintViolation", "Db", "ExceptionInput");
|
||||||
|
$s->runArray([null])->get();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue