1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace Medoo\Tests;
- use Medoo\Medoo;
- /**
- * @coversDefaultClass \Medoo\Medoo
- */
- class DeleteTest extends MedooTestCase
- {
- /**
- * @covers ::delete()
- * @dataProvider typesProvider
- */
- public function testDelete($type)
- {
- $this->setType($type);
- $this->database->delete("account", [
- "AND" => [
- "type" => "business",
- "age[<]" => 18
- ]
- ]);
- $this->assertQuery(
- <<<EOD
- DELETE FROM "account"
- WHERE ("type" = 'business' AND "age" < 18)
- EOD,
- $this->database->queryString
- );
- }
- /**
- * @covers ::delete()
- * @dataProvider typesProvider
- */
- public function testDeleteRaw($type)
- {
- $this->setType($type);
- $whereClause = Medoo::raw("WHERE (<type> = :type AND <age> < :age)", [
- ':type' => 'business',
- ':age' => 18,
- ]);
- $this->database->delete("account", $whereClause);
- $this->assertQuery(
- <<<EOD
- DELETE FROM "account"
- WHERE ("type" = 'business' AND "age" < 18)
- EOD,
- $this->database->queryString
- );
- }
- }
|