/** * */ public function testInsertFormatValues() { $faker = Faker\Factory::create(); $columns = ['RowId', 'RowDate', 'RowString']; $data = [[$id1 = $faker->randomDigitNotNull, $date1 = $faker->date, $string1 = $faker->word], [$id2 = $faker->randomDigitNotNull, $date2 = $faker->date, $string2 = $faker->word]]; $this->client->insert($this->tablename, $columns, $data); $statement = $this->client->select('SELECT * FROM ' . $this->tablename); $this->assertEquals(2, $statement->rowsCount()); $all = $statement->fetchAll(); $first = current($all); $this->assertEquals($id1, $first->RowId); $last = end($all); $this->assertEquals($id2, $last->RowId); }
public function __set($name, $value) { if (!property_exists($this, $name)) { throw new \InvalidArgumentException(sprintf('settings with name %s not exists', $name)); } $this->{$name} = $value; return $this->client->execute('SET :name = :value'); }