File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,37 @@ protected function tearDown(): void
34
34
restore_error_handler ();
35
35
}
36
36
37
+ /**
38
+ * Check PDO stringify fetches options
39
+ */
40
+ public function testStringifyFetches (): void
41
+ {
42
+ $ tableName = $ this ->resourceConnection ->getTableName ('table_with_int_column ' );
43
+ $ columnId = 'integer_column ' ;
44
+ $ adapter = $ this ->getDbAdapter ();
45
+
46
+ $ table = $ adapter
47
+ ->newTable ($ tableName )
48
+ ->addColumn ($ columnId , Table::TYPE_INTEGER );
49
+ $ adapter ->createTable ($ table );
50
+ $ adapter ->insert ($ tableName , [$ columnId => 100 ]);
51
+
52
+ $ select = $ adapter ->select ()
53
+ ->from ($ tableName )
54
+ ->columns ([$ columnId ])
55
+ ->limit (1 );
56
+ $ result = $ adapter ->fetchOne ($ select );
57
+
58
+ $ isStringify = $ adapter ->getConfig ()['driver_options ' ][\PDO ::ATTR_STRINGIFY_FETCHES ] ?? null ;
59
+ if ($ isStringify || $ isStringify === null ) {
60
+ $ this ->assertIsString ($ result );
61
+ } else { // option is set to False
62
+ $ this ->assertIsInt ($ result );
63
+ }
64
+
65
+ $ adapter ->dropTable ($ tableName );
66
+ }
67
+
37
68
/**
38
69
* Test lost connection re-initializing
39
70
*
You can’t perform that action at this time.
0 commit comments