setType($type); $this->database->insert("account", [ "user_name" => "foo", "email" => "foo@bar.com" ]); $this->assertQuery( <<database->queryString ); } /** * @covers ::insert() * @covers ::typeMap() * @dataProvider typesProvider */ public function testInsertWithArray($type) { $this->setType($type); $this->database->insert("account", [ "user_name" => "foo", "lang" => ["en", "fr"] ]); $this->assertQuery([ 'default' => << <<database->queryString); } /** * @covers ::insert() * @covers ::typeMap() * @dataProvider typesProvider */ public function testInsertWithJSON($type) { $this->setType($type); $this->database->insert("account", [ "user_name" => "foo", "lang [JSON]" => ["en", "fr"] ]); $this->assertQuery([ 'default' => << <<database->queryString); } /** * @covers ::insert() * @dataProvider typesProvider */ public function testInsertWithRaw($type) { $this->setType($type); $this->database->insert("account", [ "user_name" => Medoo::raw("UUID()") ]); $this->assertQuery( <<database->queryString ); } /** * @covers ::insert() * @covers ::typeMap() * @dataProvider typesProvider */ public function testInsertWithNull($type) { $this->setType($type); $this->database->insert("account", [ "location" => null ]); $this->assertQuery( <<database->queryString ); } /** * @covers ::insert() * @covers ::typeMap() * @dataProvider typesProvider */ public function testInsertWithObject($type) { $this->setType($type); $objectData = new Foo(); $this->database->insert("account", [ "object" => $objectData ]); $this->assertQuery( <<database->queryString ); } /** * @covers ::insert() * @dataProvider typesProvider */ public function testMultiInsert($type) { $this->setType($type); $this->database->insert("account", [ [ "user_name" => "foo", "email" => "foo@bar.com" ], [ "user_name" => "bar", "email" => "bar@foo.com" ] ]); $this->assertQuery( <<database->queryString ); } public function testOracleWithPrimaryKeyInsert() { $this->setType("oracle"); $this->database->insert("ACCOUNT", [ "NAME" => "foo", "EMAIL" => "foo@bar.com" ], "ID"); $this->assertQuery( <<database->queryString ); } public function testOracleWithLOBsInsert() { $this->setType("oracle"); $fp = fopen('README.md', 'r'); $this->database->insert("ACCOUNT", [ "NAME" => "foo", "DATA" => $fp ]); $this->assertQuery( <<database->queryString ); } public function testOracleWithLOBsAndIdInsert() { $this->setType("oracle"); $fp = fopen('README.md', 'r'); $this->database->insert("ACCOUNT", [ "NAME" => "foo", "DATA" => $fp ], "ID"); $this->assertQuery( <<database->queryString ); } }