1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 05:34:55 +00:00

Added test for recursive binding

Also fixed a bug uncovered by the test
This commit is contained in:
J. King 2017-04-06 21:24:26 -04:00
parent 818707b067
commit b02abec250
2 changed files with 14 additions and 1 deletions

View file

@ -85,6 +85,6 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
$a++; $a++;
} }
} }
return $a; return $a - $offset;
} }
} }

View file

@ -57,6 +57,19 @@ class TestDbStatementSQLite3 extends \PHPUnit\Framework\TestCase {
$this->assertSame($exp, $val); $this->assertSame($exp, $val);
} }
function testBindRecursively() {
$exp = [
'one' => 1,
'two' => 2,
'three' => 3,
'four' => 4,
];
$nativeStatement = $this->c->prepare("SELECT ? as one, ? as two, ? as three, ? as four");
$s = new self::$imp($this->c, $nativeStatement, ["int", ["int", "int"], "int"]);
$val = $s->runArray([1, [2, 3], 4])->getRow();
$this->assertSame($exp, $val);
}
function testBindWithoutType() { function testBindWithoutType() {
$nativeStatement = $this->c->prepare("SELECT ? as value"); $nativeStatement = $this->c->prepare("SELECT ? as value");
$this->assertException("paramTypeMissing", "Db"); $this->assertException("paramTypeMissing", "Db");