1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-23 10:26:21 +01:00
php-dibi/tests/dibi/Fluent.update.phpt

32 lines
610 B
Plaintext
Raw Normal View History

2015-01-12 05:33:41 +01:00
<?php
2017-06-09 22:20:47 +02:00
declare(strict_types=1);
2015-01-12 05:33:41 +01:00
use Tester\Assert;
require __DIR__ . '/bootstrap.php';
$conn = new Dibi\Connection($config);
2015-01-12 05:33:41 +01:00
2015-10-06 01:39:01 +02:00
$arr = [
2015-06-19 03:11:36 +02:00
'title' => 'Super Product',
'price' => 12,
'brand' => null,
2015-10-06 01:39:01 +02:00
];
2015-01-12 05:33:41 +01:00
$fluent = $conn->update('table', $arr)
->setFlag('IGNORE')->setFlag('DELAYED');
Assert::same(
reformat('UPDATE IGNORE DELAYED [table] SET [title]=\'Super Product\', [price]=12, [brand]=NULL'),
(string) $fluent
);
2015-10-06 01:39:01 +02:00
$fluent->set(['another' => 123]);
2015-01-12 05:33:41 +01:00
Assert::same(
reformat('UPDATE IGNORE DELAYED [table] SET [title]=\'Super Product\', [price]=12, [brand]=NULL , [another]=123'),
(string) $fluent
);