-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#15363 - Fix
Phalcon\Db\Adapter\AbstractAdapter:delete()
when `bind…
…Types` argument is passed
- Loading branch information
Showing
5 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Phalcon\Test\Database\Db\Adapter\Pdo; | ||
|
||
use DatabaseTester; | ||
use Phalcon\Test\Fixtures\Migrations\InvoicesMigration; | ||
use Phalcon\Test\Fixtures\Traits\DiTrait; | ||
use Phalcon\Test\Models\Invoices; | ||
|
||
final class DeleteCest | ||
{ | ||
use DiTrait; | ||
|
||
public function _before(DatabaseTester $I) | ||
{ | ||
$this->setNewFactoryDefault(); | ||
$this->setDatabase($I); | ||
} | ||
|
||
/** | ||
* Tests Phalcon\Db\Adapter\AbstractAdapter :: delete() | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2021-05-10 | ||
* | ||
* @group pgsql | ||
* @group mysql | ||
* @group sqlite | ||
*/ | ||
public function dbAdapterPdoQuery(DatabaseTester $I) | ||
{ | ||
$I->wantToTest('Db\Adapter\Pdo - delete()'); | ||
|
||
$connection = $I->getConnection(); | ||
$db = $this->container->get('db'); | ||
|
||
$migration = new InvoicesMigration($connection); | ||
$migration->insert(1, 1, 1, 'title 1', 101); | ||
$migration->insert(2, 1, 1, 'title 2', 102); | ||
$migration->insert(3, 1, 1, 'title 3', 103); | ||
|
||
$I->assertSame(3, Invoices::count()); | ||
|
||
$db->delete($migration->getTable(), 'inv_id > :id', [ | ||
'id' => 1, | ||
]); | ||
|
||
$I->assertSame(1, Invoices::count()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters