File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Test/Unit/Model/Indexer/Design Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ class IndexerHandler extends Grid
27
27
private $ flatScopeResolver ;
28
28
29
29
/***
30
- * Old Charset for flat table
30
+ * check for old collation
31
31
*/
32
- private const OLDCHARSET = 'utf8|utf8mb3 ' ;
32
+ private const OLDCOLLATION = 'utf8_general_ci|utf8mb3_general_ci ' ;
33
33
34
34
/***
35
35
* table design_config_grid_flat
@@ -88,8 +88,8 @@ public function cleanIndex($dimensions)
88
88
$ this ->connection ->delete ($ tableName );
89
89
// change the charset to utf8mb4
90
90
if ($ tableName === self ::DESIGN_CONFIG_GRID_FLAT ) {
91
- $ getTableSchema = $ this ->connection ->getCreateTable ($ tableName ) ?? '' ;
92
- if (preg_match ('/\b( ' . self :: OLDCHARSET .')\b/ ' , $ getTableSchema )) {
91
+ $ getTableSchema = $ this ->connection ->showTableStatus ($ tableName ) ?? '' ;
92
+ if (isset ( $ getTableSchema [ ' Collation ' ]) && preg_match ('/\b( ' . SELF :: OLDCOLLATION .')\b/ ' , $ getTableSchema[ ' Collation ' ] )) {
93
93
$ charset = $ this ->columnConfig ->getDefaultCharset ();
94
94
$ collate = $ this ->columnConfig ->getDefaultCollation ();
95
95
$ columnEncoding = " CHARACTER SET " .$ charset ." COLLATE " .$ collate ;
Original file line number Diff line number Diff line change 22
22
use Magento \Framework \Indexer \ScopeResolver \FlatScopeResolver ;
23
23
use Magento \Framework \Indexer \ScopeResolver \IndexScopeResolver ;
24
24
use Magento \Framework \Indexer \StructureFactory ;
25
+ use Magento \Framework \Setup \Declaration \Schema \Dto \Factories \Table as DtoFactoriesTable ;
25
26
use Magento \Theme \Model \Data \Design \Config as DesignConfig ;
26
27
use Magento \Theme \Model \Indexer \Design \Config ;
27
28
use Magento \Theme \Model \ResourceModel \Design \Config \Scope \CollectionFactory ;
@@ -91,6 +92,10 @@ class ConfigTest extends TestCase
91
92
* @var CollectionFactory|MockObject
92
93
*/
93
94
private $ collectionFactory ;
95
+ /***
96
+ * @var DtoFactoriesTable|MockObject
97
+ */
98
+ private $ dtoFactoriesTable ;
94
99
95
100
protected function setUp (): void
96
101
{
@@ -132,6 +137,9 @@ protected function setUp(): void
132
137
->getMock ();
133
138
$ this ->indexerFieldset = $ this ->getMockBuilder (FieldsetInterface::class)
134
139
->getMockForAbstractClass ();
140
+ $ this ->dtoFactoriesTable = $ this ->getMockBuilder (DtoFactoriesTable::class)
141
+ ->disableOriginalConstructor ()
142
+ ->getMock ();
135
143
}
136
144
137
145
/**
@@ -171,7 +179,9 @@ private function getDesignConfigIndexerModel(): Config
171
179
[
172
180
'fieldsets ' => [],
173
181
'indexer_id ' => DesignConfig::DESIGN_CONFIG_GRID_INDEXER_ID
174
- ]
182
+ ],
183
+ [],
184
+ $ this ->dtoFactoriesTable
175
185
);
176
186
177
187
$ this ->saveHandlerFactory ->expects ($ this ->any ())
You can’t perform that action at this time.
0 commit comments