public function testInsertTtlTimestamp() { $stmt = CqlQueryBuilder::insertInto('tbl', 'field1', 'field2')->values('value1', 'value2')->usingTtl(50)->usingTimestamp(123456); $this->assertEquals('INSERT INTO "tbl" ("field1", "field2") VALUES (\'value1\', \'value2\') USING TTL 50 AND TIMESTAMP 123456', CqlAssembler::stringify($stmt)); $assembler = new CqlAssembler($stmt); $this->assertEquals('INSERT INTO "tbl" ("field1", "field2") VALUES (?, ?) USING TTL ? AND TIMESTAMP ?', $assembler->getQuery()); $this->assertEquals(['value1', 'value2', 50, 123456], $assembler->getParameters()); }
public function testUpdateTtlTimestamp() { $stmt = CqlQueryBuilder::update('tbl', ['field1' => 'value1'])->usingTtl(50)->usingTimestamp(123456); $this->assertEquals('UPDATE "tbl" USING TTL 50 AND TIMESTAMP 123456 SET "field1" = \'value1\'', CqlAssembler::stringify($stmt)); $assembler = new CqlAssembler($stmt); $this->assertEquals('UPDATE "tbl" USING TTL ? AND TIMESTAMP ? SET "field1" = ?', $assembler->getQuery()); $this->assertEquals([50, 123456, 'value1'], $assembler->getParameters()); }