mirror of
https://github.com/dg/dibi.git
synced 2025-08-31 01:39:46 +02:00
new directory structure, moved to /src
This commit is contained in:
35
tests/dibi/Connection.affectedRows.phpt
Normal file
35
tests/dibi/Connection.affectedRows.phpt
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @dataProvider ../databases.ini
|
||||
*/
|
||||
|
||||
use Tester\Assert;
|
||||
|
||||
require __DIR__ . '/bootstrap.php';
|
||||
|
||||
$conn = new DibiConnection($config);
|
||||
$conn->loadFile(__DIR__ . "/data/$config[system].sql");
|
||||
|
||||
|
||||
$conn->query('INSERT INTO products', array(
|
||||
'title' => 'Test product',
|
||||
));
|
||||
Assert::same(1, $conn->getAffectedRows());
|
||||
|
||||
|
||||
$conn->query('UPDATE products SET title="xxx" WHERE product_id > 100');
|
||||
Assert::same(0, $conn->getAffectedRows());
|
||||
|
||||
|
||||
$conn->query('UPDATE products SET title="xxx"');
|
||||
Assert::same(4, $conn->getAffectedRows());
|
||||
|
||||
|
||||
$conn->query('DELETE FROM orders');
|
||||
$conn->query('DELETE FROM products WHERE product_id > 100');
|
||||
Assert::same(0, $conn->getAffectedRows());
|
||||
|
||||
|
||||
$conn->query('DELETE FROM products WHERE product_id < 3');
|
||||
Assert::same(2, $conn->getAffectedRows());
|
Reference in New Issue
Block a user