File tree Expand file tree Collapse file tree 3 files changed +56
-3
lines changed
dev/tests/setup-integration
_files/Magento/TestSetupDeclarationModule8/revisions/unpatterned_fk_name Expand file tree Collapse file tree 3 files changed +56
-3
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <schema xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
9
+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd" >
10
+ <table name =" test_table" resource =" default" comment =" Test Table" >
11
+ <column xsi : type =" int" name =" page_id" nullable =" false" unsigned =" false" identity =" true" />
12
+ <constraint xsi : type =" primary" referenceId =" PRIMARY" >
13
+ <column name =" page_id" />
14
+ </constraint >
15
+ </table >
16
+ <table name =" test_scope_table" resource =" default" comment =" Test Scope Table" >
17
+ <column xsi : type =" int" name =" scope_id" nullable =" false" unsigned =" false" identity =" true" />
18
+ <constraint xsi : type =" primary" referenceId =" PRIMARY" >
19
+ <column name =" scope_id" />
20
+ </constraint >
21
+ </table >
22
+ <table name =" dependent" resource =" default" comment =" Lol" >
23
+ <column xsi : type =" int" name =" page_id_on" nullable =" false" unsigned =" false" />
24
+ <column xsi : type =" int" name =" scope_id_on" nullable =" false" unsigned =" false" />
25
+ <!-- Expected name in DB: DEPENDENT_PAGE_ID_ON_TEST_TABLE_PAGE_ID -->
26
+ <constraint xsi : type =" foreign" referenceId =" FOREIGN" table =" dependent" column =" page_id_on" referenceColumn =" page_id"
27
+ referenceTable =" test_table" />
28
+ <!-- Expected name in DB: DEPENDENT_SCOPE_ID_ON_TEST_SCOPE_TABLE_SCOPE_ID -->
29
+ <constraint xsi : type =" foreign" referenceId =" ScopeIDOnTOScopeTableAndScopeId" table =" dependent" column =" scope_id_on" referenceColumn =" scope_id"
30
+ referenceTable =" test_scope_table" />
31
+ </table >
32
+ </schema >
Original file line number Diff line number Diff line change 32
32
<includePath >testsuite</includePath >
33
33
<ini name =" date.timezone" value =" America/Los_Angeles" />
34
34
<ini name =" xdebug.max_nesting_level" value =" 200" />
35
- <const name =" TESTS_INSTALL_CONFIG_FILE" value =" {{local_config_file}} " />
35
+ <const name =" TESTS_INSTALL_CONFIG_FILE" value =" etc/install-config-mysql.php " />
36
36
<const name =" TESTS_GLOBAL_CONFIG_FILE" value =" etc/config-global.php" />
37
37
<const name =" TESTS_GLOBAL_CONFIG_DIR" value =" ../../../app/etc" />
38
- <const name =" TESTS_CLEANUP" value =" {{tests_cleanup}} " />
39
- <const name =" TESTS_MAGENTO_MODE" value =" {{app_mode}} " />
38
+ <const name =" TESTS_CLEANUP" value =" enabled " />
39
+ <const name =" TESTS_MAGENTO_MODE" value =" developer " />
40
40
<const name =" TESTS_ERROR_LOG_LISTENER_LEVEL" value =" 1" />
41
41
</php >
42
42
<!-- Test listeners -->
Original file line number Diff line number Diff line change @@ -296,4 +296,25 @@ public function testTableRename()
296
296
->from ($ this ->resourceConnection ->getTableName ('some_table_renamed ' ));
297
297
self ::assertEquals ([$ dataToMigrate ], $ adapter ->fetchAll ($ select ));
298
298
}
299
+
300
+ /**
301
+ * @moduleName Magento_TestSetupDeclarationModule8
302
+ */
303
+ public function testForeignKeyReferenceId ()
304
+ {
305
+ $ this ->cliCommad ->install (
306
+ ['Magento_TestSetupDeclarationModule8 ' ]
307
+ );
308
+ $ this ->moduleManager ->updateRevision (
309
+ 'Magento_TestSetupDeclarationModule8 ' ,
310
+ 'unpatterned_fk_name ' ,
311
+ 'db_schema.xml ' ,
312
+ 'etc '
313
+ );
314
+ $ this ->cliCommad ->upgrade ();
315
+ $ tableStatements = $ this ->describeTable ->describeShard ('default ' );
316
+ $ tableSql = $ tableStatements ['dependent ' ];
317
+ $ this ->assertRegExp ('/CONSTRAINT\s`DEPENDENT_PAGE_ID_ON_TEST_TABLE_PAGE_ID`/ ' , $ tableSql );
318
+ $ this ->assertRegExp ('/CONSTRAINT\s`DEPENDENT_SCOPE_ID_ON_TEST_SCOPE_TABLE_SCOPE_ID`/ ' , $ tableSql );
319
+ }
299
320
}
You can’t perform that action at this time.
0 commit comments