Passed
Pull Request — master (#397)
by Wilmer
02:36
created

AbstractCommandTest::testCreateView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 15
nc 1
nop 0
dl 0
loc 21
rs 9.7666
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Cache\Dependency\TagDependency;
9
use Yiisoft\Db\Command\CommandInterface;
10
use Yiisoft\Db\Command\Param;
11
use Yiisoft\Db\Command\ParamInterface;
12
use Yiisoft\Db\Driver\PDO\CommandPDOInterface;
13
use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface;
14
use Yiisoft\Db\Exception\Exception;
15
use Yiisoft\Db\Exception\InvalidCallException;
16
use Yiisoft\Db\Exception\InvalidConfigException;
17
use Yiisoft\Db\Exception\InvalidParamException;
18
use Yiisoft\Db\Exception\NotSupportedException;
19
use Yiisoft\Db\Expression\Expression;
20
use Yiisoft\Db\Query\Data\DataReader;
21
use Yiisoft\Db\Query\Query;
22
use Yiisoft\Db\Schema\Schema;
23
use Yiisoft\Db\Schema\SchemaBuilderTrait;
24
use Yiisoft\Db\Tests\Support\Assert;
25
use Yiisoft\Db\Tests\Support\DbHelper;
26
use Yiisoft\Db\Tests\Support\TestTrait;
27
28
use function call_user_func_array;
29
30
abstract class AbstractCommandTest extends TestCase
31
{
32
    use SchemaBuilderTrait;
33
    use TestTrait;
34
35
    protected ConnectionPDOInterface $db;
36
    protected string $upsertTestCharCast = '';
37
38
    public function testAddCheck(): void
39
    {
40
        $db = $this->getConnection();
41
42
        $command = $db->createCommand();
43
        $sql = $command->addCheck('name', 'table', 'id > 0')->getSql();
44
45
46
        $this->assertSame(
47
            DbHelper::replaceQuotes(
48
                <<<SQL
49
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] CHECK (id > 0)
50
                SQL,
51
                $db->getName(),
52
            ),
53
            $sql,
54
        );
55
    }
56
57
    public function testAddColumn(): void
58
    {
59
        $db = $this->getConnection();
60
61
        $command = $db->createCommand();
62
        $sql = $command->addColumn('table', 'column', Schema::TYPE_INTEGER)->getSql();
63
64
        $this->assertSame(
65
            DbHelper::replaceQuotes(
66
                <<<SQL
67
                ALTER TABLE [[table]] ADD [[column]] integer
68
                SQL,
69
                $db->getName(),
70
            ),
71
            $sql,
72
        );
73
    }
74
75
    public function testAddCommentOnColumn(): void
76
    {
77
        $db = $this->getConnection();
78
79
        $command = $db->createCommand();
80
        $sql = $command->addCommentOnColumn('customer', 'id', 'Primary key.')->getSql();
81
82
        $this->assertStringContainsString(
83
            DbHelper::replaceQuotes(
84
                <<<SQL
85
                COMMENT ON COLUMN [[customer]].[[id]] IS 'Primary key.'
86
                SQL,
87
                $db->getName(),
88
            ),
89
            $sql,
90
        );
91
    }
92
93
    public function testAddCommentOnTable(): void
94
    {
95
        $db = $this->getConnection();
96
97
        $command = $db->createCommand();
98
        $sql = $command->addCommentOnTable('table', 'comment')->getSql();
99
100
        $this->assertSame(
101
            DbHelper::replaceQuotes(
102
                <<<SQL
103
                COMMENT ON TABLE [[table]] IS 'comment'
104
                SQL,
105
                $db->getName(),
106
            ),
107
            $sql,
108
        );
109
    }
110
111
    public function testAddDefaultValue(): void
112
    {
113
        $db = $this->getConnection();
114
115
        $command = $db->createCommand();
116
117
        $this->expectException(NotSupportedException::class);
118
        $this->expectExceptionMessage(
119
            'Yiisoft\Db\QueryBuilder\DDLQueryBuilder::addDefaultValue() does not support adding default value constraints.'
120
        );
121
122
        $command->addDefaultValue('name', 'table', 'column', 'value');
123
    }
124
125
    public function testAddForeignKey(): void
126
    {
127
        $db = $this->getConnection();
128
129
        $command = $db->createCommand();
130
        $sql = $command->addForeignKey('name', 'table', 'column', 'ref_table', 'ref_column')->getSql();
131
132
        $this->assertSame(
133
            DbHelper::replaceQuotes(
134
                <<<SQL
135
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] FOREIGN KEY ([[column]]) REFERENCES [[ref_table]] ([[ref_column]])
136
                SQL,
137
                $db->getName(),
138
            ),
139
            $sql,
140
        );
141
142
        $sql = $command->addForeignKey('name', 'table', 'column', 'ref_table', 'ref_column', 'CASCADE')->getSql();
143
144
        $this->assertSame(
145
            DbHelper::replaceQuotes(
146
                <<<SQL
147
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] FOREIGN KEY ([[column]]) REFERENCES [[ref_table]] ([[ref_column]]) ON DELETE CASCADE
148
                SQL,
149
                $db->getName(),
150
            ),
151
            $sql,
152
        );
153
154
        $sql = $command
155
            ->addForeignKey('name', 'table', 'column', 'ref_table', 'ref_column', 'CASCADE', 'CASCADE')
156
            ->getSql();
157
158
        $this->assertSame(
159
            DbHelper::replaceQuotes(
160
                <<<SQL
161
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] FOREIGN KEY ([[column]]) REFERENCES [[ref_table]] ([[ref_column]]) ON DELETE CASCADE ON UPDATE CASCADE
162
                SQL,
163
                $db->getName(),
164
            ),
165
            $sql,
166
        );
167
    }
168
169
    public function testAddPrimaryKey(): void
170
    {
171
        $db = $this->getConnection();
172
173
        $command = $db->createCommand();
174
        $sql = $command->addPrimaryKey('name', 'table', 'column')->getSql();
175
176
177
        $this->assertSame(
178
            DbHelper::replaceQuotes(
179
                <<<SQL
180
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] PRIMARY KEY ([[column]])
181
                SQL,
182
                $db->getName(),
183
            ),
184
            $sql,
185
        );
186
187
        $sql = $command->addPrimaryKey('name', 'table', ['column1', 'column2'])->getSql();
188
189
190
        $this->assertSame(
191
            DbHelper::replaceQuotes(
192
                <<<SQL
193
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] PRIMARY KEY ([[column1]], [[column2]])
194
                SQL,
195
                $db->getName(),
196
            ),
197
            $sql,
198
        );
199
    }
200
201
    public function testAddUnique(): void
202
    {
203
        $db = $this->getConnection();
204
205
        $command = $db->createCommand();
206
        $sql = $command->addUnique('name', 'table', 'column')->getSql();
207
208
        $this->assertSame(
209
            DbHelper::replaceQuotes(
210
                <<<SQL
211
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] UNIQUE ([[column]])
212
                SQL,
213
                $db->getName(),
214
            ),
215
            $sql,
216
        );
217
218
        $sql = $command->addUnique('name', 'table', ['column1', 'column2'])->getSql();
219
220
        $this->assertSame(
221
            DbHelper::replaceQuotes(
222
                <<<SQL
223
                ALTER TABLE [[table]] ADD CONSTRAINT [[name]] UNIQUE ([[column1]], [[column2]])
224
                SQL,
225
                $db->getName(),
226
            ),
227
            $sql,
228
        );
229
    }
230
231
    public function testAlterColumn(): void
232
    {
233
        $db = $this->getConnection();
234
235
        $command = $db->createCommand();
236
        $sql = $command->alterColumn('table', 'column', Schema::TYPE_INTEGER)->getSql();
237
238
        $this->assertSame(
239
            DbHelper::replaceQuotes(
240
                <<<SQL
241
                ALTER TABLE [[table]] CHANGE [[column]] [[column]] integer
242
                SQL,
243
                $db->getName(),
244
            ),
245
            $sql,
246
        );
247
    }
248
249
    public function testBindValues(): void
250
    {
251
        $db = $this->getConnection();
252
253
        $command = $db->createCommand();
254
255
        $values = ['int' => 1, 'string' => 'str'];
256
        $command->bindValues($values);
257
        $bindedValues = $command->getParams(false);
258
259
        $this->assertIsArray($bindedValues);
260
        $this->assertContainsOnlyInstancesOf(ParamInterface::class, $bindedValues);
261
        $this->assertCount(2, $bindedValues);
262
263
        $param = new Param('str', 99);
264
        $command->bindValues(['param' => $param]);
265
        $bindedValues = $command->getParams(false);
266
267
        $this->assertIsArray($bindedValues);
268
        $this->assertContainsOnlyInstancesOf(ParamInterface::class, $bindedValues);
269
        $this->assertCount(3, $bindedValues);
270
        $this->assertSame($param, $bindedValues['param']);
271
        $this->assertNotEquals($param, $bindedValues['int']);
272
273
        /* Replace test */
274
        $command->bindValues(['int' => $param]);
275
        $bindedValues = $command->getParams(false);
276
277
        $this->assertIsArray($bindedValues);
278
        $this->assertContainsOnlyInstancesOf(ParamInterface::class, $bindedValues);
279
        $this->assertCount(3, $bindedValues);
280
        $this->assertSame($param, $bindedValues['int']);
281
    }
282
283
    public function testCache(): void
284
    {
285
        $db = $this->getConnection();
286
287
        $tagDependency = new TagDependency('tag');
288
        $command = $db->createCommand();
289
        $command->cache(100, $tagDependency);
290
291
        $this->assertInstanceOf(CommandInterface::class, $command);
292
        $this->assertSame(100, Assert::getInaccessibleProperty($command, 'queryCacheDuration'));
293
        $this->assertSame($tagDependency, Assert::getInaccessibleProperty($command, 'queryCacheDependency'));
294
    }
295
296
    public function testConstruct(): void
297
    {
298
        $db = $this->getConnection();
299
300
        $command = $db->createCommand();
301
302
        $this->assertEmpty($command->getSql());
303
304
        $sql = <<<SQL
305
        SELECT * FROM customer WHERE name=:name
306
        SQL;
307
        $command = $db->createCommand($sql, [':name' => 'John']);
308
309
        $this->assertSame($sql, $command->getSql());
310
        $this->assertSame([':name' => 'John'], $command->getParams());
311
    }
312
313
    /**
314
     * @dataProvider \Yiisoft\Db\Tests\Provider\CommandProvider::createIndex()
315
     */
316
    public function testCreateIndex(
317
        string $name,
318
        string $table,
319
        array|string $column,
320
        string $indexType,
321
        string $indexMethod,
322
        string $expected,
323
    ): void {
324
        $db = $this->getConnection();
325
326
        $command = $db->createCommand();
327
328
        $sql = $command->createIndex($name, $table, $column, $indexType, $indexMethod)->getSql();
329
330
        $this->assertSame($expected, $sql);
331
    }
332
333
    public function testDataReaderCreationException(): void
334
    {
335
        $db = $this->getConnection('customer');
336
337
        /** @var CommandPDOInterface $command */
338
        $command = $db->createCommand();
339
340
        $this->expectException(InvalidParamException::class);
341
        $this->expectExceptionMessage('The PDOStatement cannot be null.');
342
343
        $sql = 'SELECT * FROM {{customer}}';
344
345
        new DataReader($command->setSql($sql));
346
    }
347
348
    public function testDelete(): void
349
    {
350
        $db = $this->getConnection();
351
352
        $command = $db->createCommand();
353
        $sql = $command->delete('table', ['column' => 'value'])->getSql();
354
355
        $this->assertSame(
356
            DbHelper::replaceQuotes(
357
                <<<SQL
358
                DELETE FROM [[table]] WHERE [[column]]=:qp0
359
                SQL,
360
                $db->getName(),
361
            ),
362
            $sql,
363
        );
364
    }
365
366
    public function testDropCheck(): void
367
    {
368
        $db = $this->getConnection();
369
370
        $command = $db->createCommand();
371
        $sql = $command->dropCheck('name', 'table')->getSql();
372
373
        $this->assertSame(
374
            DbHelper::replaceQuotes(
375
                <<<SQL
376
                ALTER TABLE [[table]] DROP CONSTRAINT [[name]]
377
                SQL,
378
                $db->getName(),
379
            ),
380
            $sql,
381
        );
382
    }
383
384
    public function testDropColumn(): void
385
    {
386
        $db = $this->getConnection();
387
388
        $command = $db->createCommand();
389
        $sql = $command->dropColumn('table', 'column')->getSql();
390
391
        $this->assertSame(
392
            DbHelper::replaceQuotes(
393
                <<<SQL
394
                ALTER TABLE [[table]] DROP COLUMN [[column]]
395
                SQL,
396
                $db->getName(),
397
            ),
398
            $sql,
399
        );
400
    }
401
402
    public function testDropCommentFromColumn(): void
403
    {
404
        $db = $this->getConnection();
405
406
        $command = $db->createCommand();
407
        $sql = $command->dropCommentFromColumn('table', 'column')->getSql();
408
409
        $this->assertSame(
410
            DbHelper::replaceQuotes(
411
                <<<SQL
412
                COMMENT ON COLUMN [[table]].[[column]] IS NULL
413
                SQL,
414
                $db->getName(),
415
            ),
416
            $sql,
417
        );
418
    }
419
420
    public function testDropCommentFromTable(): void
421
    {
422
        $db = $this->getConnection();
423
424
        $command = $db->createCommand();
425
        $sql = $command->dropCommentFromTable('table')->getSql();
426
427
        $this->assertSame(
428
            DbHelper::replaceQuotes(
429
                <<<SQL
430
                COMMENT ON TABLE [[table]] IS NULL
431
                SQL,
432
                $db->getName(),
433
            ),
434
            $sql,
435
        );
436
    }
437
438
    public function testDropDefaultValue(): void
439
    {
440
        $db = $this->getConnection();
441
442
        $command = $db->createCommand();
443
444
        $this->expectException(NotSupportedException::class);
445
        $this->expectExceptionMessage(
446
            'Yiisoft\Db\QueryBuilder\DDLQueryBuilder::dropDefaultValue() does not support dropping default value constraints.'
447
        );
448
449
        $command->dropDefaultValue('column', 'table');
450
    }
451
452
    public function testDropForeingKey(): void
453
    {
454
        $db = $this->getConnection();
455
456
        $command = $db->createCommand();
457
        $sql = $command->dropForeignKey('name', 'table')->getSql();
458
459
        $this->assertSame(
460
            DbHelper::replaceQuotes(
461
                <<<SQL
462
                ALTER TABLE [[table]] DROP CONSTRAINT [[name]]
463
                SQL,
464
                $db->getName(),
465
            ),
466
            $sql,
467
        );
468
    }
469
470
    public function testDropIndex(): void
471
    {
472
        $db = $this->getConnection();
473
474
        $command = $db->createCommand();
475
        $sql = $command->dropIndex('name', 'table')->getSql();
476
477
        $this->assertSame(
478
            DbHelper::replaceQuotes(
479
                <<<SQL
480
                DROP INDEX [[name]] ON [[table]]
481
                SQL,
482
                $db->getName(),
483
            ),
484
            $sql,
485
        );
486
    }
487
488
    public function testDropPrimaryKey(): void
489
    {
490
        $db = $this->getConnection();
491
492
        $command = $db->createCommand();
493
        $sql = $command->dropPrimaryKey('name', 'table')->getSql();
494
495
        $this->assertSame(
496
            DbHelper::replaceQuotes(
497
                <<<SQL
498
                ALTER TABLE [[table]] DROP CONSTRAINT [[name]]
499
                SQL,
500
                $db->getName(),
501
            ),
502
            $sql,
503
        );
504
    }
505
506
    public function testDropTable(): void
507
    {
508
        $db = $this->getConnection();
509
510
        $command = $db->createCommand();
511
        $sql = $command->dropTable('table')->getSql();
512
513
        $this->assertSame(
514
            DbHelper::replaceQuotes(
515
                <<<SQL
516
                DROP TABLE [[table]]
517
                SQL,
518
                $db->getName(),
519
            ),
520
            $sql,
521
        );
522
    }
523
524
    public function testDropView(): void
525
    {
526
        $db = $this->getConnection();
527
528
        $command = $db->createCommand();
529
        $sql = $command->dropView('view')->getSql();
530
531
        $this->assertSame(
532
            DbHelper::replaceQuotes(
533
                <<<SQL
534
                DROP VIEW [[view]]
535
                SQL,
536
                $db->getName(),
537
            ),
538
            $sql,
539
        );
540
    }
541
542
    public function testDropUnique(): void
543
    {
544
        $db = $this->getConnection();
545
546
        $command = $db->createCommand();
547
        $sql = $command->dropUnique('name', 'table')->getSql();
548
549
        $this->assertSame(
550
            DbHelper::replaceQuotes(
551
                <<<SQL
552
                ALTER TABLE [[table]] DROP CONSTRAINT [[name]]
553
                SQL,
554
                $db->getName(),
555
            ),
556
            $sql,
557
        );
558
    }
559
560
    public function testExecuteWithSqlEmtpy(): void
561
    {
562
        $db = $this->getConnection();
563
564
        $command = $db->createCommand();
565
566
        $this->assertSame(0, $command->execute());
567
    }
568
569
    public function testGetParams(): void
570
    {
571
        $db = $this->getConnection();
572
573
        $command = $db->createCommand();
574
        $values = [
575
            'int' => 1,
576
            'string' => 'str',
577
        ];
578
        $command->bindValues($values);
579
        $bindedValues = $command->getParams(false);
580
581
        $this->assertIsArray($bindedValues);
582
        $this->assertContainsOnlyInstancesOf(ParamInterface::class, $bindedValues);
583
        $this->assertCount(2, $bindedValues);
584
585
        $param = new Param('str', 99);
586
        $command->bindValues(['param' => $param]);
587
        $bindedValues = $command->getParams(false);
588
589
        $this->assertIsArray($bindedValues);
590
        $this->assertContainsOnlyInstancesOf(ParamInterface::class, $bindedValues);
591
        $this->assertCount(3, $bindedValues);
592
        $this->assertEquals($param, $bindedValues['param']);
593
        $this->assertNotEquals($param, $bindedValues['int']);
594
595
        /* Replace test */
596
        $command->bindValues(['int' => $param]);
597
        $bindedValues = $command->getParams(false);
598
599
        $this->assertIsArray($bindedValues);
600
        $this->assertContainsOnlyInstancesOf(ParamInterface::class, $bindedValues);
601
        $this->assertCount(3, $bindedValues);
602
        $this->assertEquals($param, $bindedValues['int']);
603
    }
604
605
    /**
606
     * Test command getRawSql.
607
     *
608
     * @dataProvider \Yiisoft\Db\Tests\Provider\CommandProvider::rawSql()
609
     *
610
     * @throws Exception
611
     * @throws InvalidConfigException
612
     * @throws NotSupportedException
613
     *
614
     * {@see https://github.com/yiisoft/yii2/issues/8592}
615
     */
616
    public function testGetRawSql(string $sql, array $params, string $expectedRawSql): void
617
    {
618
        $db = $this->getConnection();
619
620
        $command = $db->createCommand($sql, $params);
621
622
        $this->assertSame($expectedRawSql, $command->getRawSql());
623
    }
624
625
    public function testGetSetSql(): void
626
    {
627
        $db = $this->getConnection();
628
629
        $sql = <<<SQL
630
        SELECT * FROM customer
631
        SQL;
632
        $command = $db->createCommand($sql);
633
        $this->assertSame($sql, $command->getSql());
634
635
        $sql2 = <<<SQL
636
        SELECT * FROM order
637
        SQL;
638
        $command->setSql($sql2);
639
        $this->assertSame($sql2, $command->getSql());
640
    }
641
642
    public function testLastInsertIdException(): void
643
    {
644
        $db = $this->getConnection();
645
646
        $db->close();
647
648
        $this->expectException(InvalidCallException::class);
649
650
        $db->getLastInsertID();
651
    }
652
653
    public function testNoCache(): void
654
    {
655
        $db = $this->getConnection();
656
657
        $command = $db->createCommand()->noCache();
658
659
        $this->assertSame(-1, Assert::getInaccessibleProperty($command, 'queryCacheDuration'));
660
        $this->assertInstanceOf(CommandInterface::class, $command);
661
    }
662
663
    public function testPrepareCancel(): void
664
    {
665
        $db = $this->getConnection('customer');
666
667
        $command = $db->createCommand();
668
        $command->setSql(
669
            <<<SQL
670
            SELECT * FROM {{customer}}
671
            SQL
672
        );
673
674
        $this->assertNull($command->getPdoStatement());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $command->getPdoStatement() targeting Yiisoft\Db\Driver\PDO\Co...dPDO::getPdoStatement() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
675
676
        $command->prepare();
677
678
        $this->assertNotNull($command->getPdoStatement());
679
680
        $command->cancel();
681
682
        $this->assertNull($command->getPdoStatement());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $command->getPdoStatement() targeting Yiisoft\Db\Driver\PDO\Co...dPDO::getPdoStatement() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
683
    }
684
685
    public function testRenameColumn(): void
686
    {
687
        $db = $this->getConnection();
688
689
        $sql = $db->createCommand()->renameColumn('table', 'oldname', 'newname')->getSql();
690
691
        $this->assertSame(
692
            DbHelper::replaceQuotes(
693
                <<<SQL
694
                ALTER TABLE [[table]] RENAME COLUMN [[oldname]] TO [[newname]]
695
                SQL,
696
                $db->getName(),
697
            ),
698
            $sql,
699
        );
700
    }
701
702
    public function testSetRawSql(): void
703
    {
704
        $db = $this->getConnection();
705
706
        $command = $db->createCommand();
707
        $command->setRawSql(
708
            <<<SQL
709
            SELECT 123
710
            SQL
711
        );
712
713
        $this->assertSame('SELECT 123', $command->getRawSql());
714
    }
715
716
    public function testSetRetryHandler(): void
717
    {
718
        $db = $this->getConnection();
719
720
        $command = $db->createCommand();
721
722
        $handler = static fn (): bool => true;
723
724
        Assert::invokeMethod($command, 'setRetryHandler', [$handler]);
725
726
        $this->assertSame($handler, Assert::getInaccessibleProperty($command, 'retryHandler'));
727
    }
728
729
    public function testTruncateTable(): void
730
    {
731
        $db = $this->getConnection();
732
733
        $command = $db->createCommand();
734
        $sql = $command->truncateTable('table')->getSql();
735
736
        $this->assertSame(
737
            DbHelper::replaceQuotes(
738
                <<<SQL
739
                TRUNCATE TABLE [[table]]
740
                SQL,
741
                $db->getName(),
742
            ),
743
            $sql,
744
        );
745
    }
746
747
    protected function performAndCompareUpsertResult(ConnectionPDOInterface $db, array $data): void
748
    {
749
        $params = $data['params'];
750
        $expected = $data['expected'] ?? $params[1];
751
752
        $command = $db->createCommand();
753
754
        call_user_func_array([$command, 'upsert'], $params);
755
756
        $command->execute();
757
758
        $actual = (new Query($db))
759
            ->select(['email', 'address' => new Expression($this->upsertTestCharCast), 'status'])
760
            ->from('T_upsert')
761
            ->one();
762
        $this->assertEquals($expected, $actual, $this->upsertTestCharCast);
763
    }
764
}
765