public function testUpdate() { $update = $this->connection->update('test', ['foo' => 'bar']); $this->assertInstanceOf('Flame\\QueryBuilder\\UpdateQuery', $update); $this->assertAttributeSame('test', 'table', $update); $this->assertAttributeSame(['"foo"' => 'bar'], 'columns', $update); }
public function testValueConverters() { $this->insertStatement->execute(['username' => null, 'age' => '20foobar']); $user = $this->connection->query('SELECT username, age FROM users ORDER BY id DESC')->fetch(\PDO::FETCH_ASSOC); $this->assertEquals(['username' => null, 'age' => '20'], $user); $date = new \DateTime(); $this->insertStatement->execute(['username' => 'foo', 'date' => $date, 'time' => $date]); $user = $this->connection->query('SELECT registered, spend_time FROM users WHERE username = "******"')->fetch(\PDO::FETCH_ASSOC); $this->assertEquals(['registered' => $date->format(Grammar::DATE_TIME_FORMAT), 'spend_time' => $date->format(Grammar::TIME_FORMAT)], $user); }