Skip to content

Commit 84e1f0f

Browse files
MC-38765: Ensure there are no split db specific tests
1 parent 878f950 commit 84e1f0f

File tree

13 files changed

+413
-5
lines changed

13 files changed

+413
-5
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\TestSetupDeclarationModule2\Setup;
8+
9+
use Magento\Framework\Setup\InstallSchemaInterface;
10+
use Magento\Framework\Setup\ModuleContextInterface;
11+
use Magento\Framework\Setup\SchemaSetupInterface;
12+
13+
/**
14+
* InstallSchema mock class.
15+
*/
16+
class InstallSchema implements InstallSchemaInterface
17+
{
18+
/**
19+
* {@inheritdoc}
20+
*/
21+
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
22+
{
23+
$installer = $setup;
24+
$installer->startSetup();
25+
$installer->endSetup();
26+
}
27+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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_one" resource="shard_one">
11+
<column xsi:type="smallint" identity="true" name="smallint" padding="3" nullable="true"/>
12+
<column xsi:type="varchar" name="varchar" length="254" nullable="true"/>
13+
<constraint xsi:type="primary" referenceId="PRIMARY">
14+
<column name="smallint" />
15+
</constraint>
16+
</table>
17+
<table name="test_table_two" resource="shard_two">
18+
<column xsi:type="smallint" identity="true" name="smallint" padding="3" nullable="true"/>
19+
<column xsi:type="varchar" name="varchar" length="254" nullable="true"/>
20+
<constraint xsi:type="primary" referenceId="PRIMARY">
21+
<column name="smallint" />
22+
</constraint>
23+
</table>
24+
<table name="reference_table" resource="default">
25+
<column xsi:type="tinyint" name="tinyint_ref" padding="7" nullable="false" identity="true" unsigned="false"/>
26+
<column xsi:type="tinyint" name="tinyint_without_padding" default="0" nullable="false" unsigned="false"/>
27+
<column xsi:type="bigint" name="bigint_without_padding" default="0" nullable="false" unsigned="false"/>
28+
<column xsi:type="smallint" name="smallint_without_padding" default="0" nullable="false" unsigned="false"/>
29+
<column xsi:type="int" name="integer_without_padding" default="0" nullable="false" unsigned="false"/>
30+
<column xsi:type="smallint" name="smallint_with_big_padding" padding="254" default="0" nullable="false"
31+
unsigned="false"/>
32+
<column xsi:type="smallint" name="smallint_without_default" padding="2" nullable="true" unsigned="false"/>
33+
<column xsi:type="int" name="int_without_unsigned" padding="2" nullable="true"/>
34+
<column xsi:type="int" name="int_unsigned" padding="2" nullable="true" unsigned="true"/>
35+
<column xsi:type="bigint" name="bigint_default_nullable" padding="2" nullable="true" default="1"
36+
unsigned="true"/>
37+
<column xsi:type="bigint" name="bigint_not_default_not_nullable" padding="2" nullable="false" unsigned="true"/>
38+
<constraint xsi:type="primary" referenceId="tinyint_primary">
39+
<column name="tinyint_ref"/>
40+
</constraint>
41+
</table>
42+
<table name="auto_increment_test" resource="default">
43+
<column xsi:type="int" name="int_auto_increment_with_nullable" identity="true" padding="12" unsigned="true"
44+
nullable="true"/>
45+
<column xsi:type="smallint" name="int_disabled_auto_increment" default="0" identity="false" padding="12"
46+
unsigned="true" nullable="true"/>
47+
<constraint xsi:type="unique" referenceId="AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE">
48+
<column name="int_auto_increment_with_nullable"/>
49+
</constraint>
50+
</table>
51+
</schema>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"test_table_one": {
3+
"column": []
4+
},
5+
"test_table_two": {
6+
"column": []
7+
},
8+
"reference_table": {
9+
"column": []
10+
},
11+
"auto_increment_test": {
12+
"column": []
13+
}
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9+
<type name="Magento\Framework\Setup\Declaration\Schema\Sharding">
10+
<arguments>
11+
<argument name="resources" xsi:type="array">
12+
<item name="default" xsi:type="string">default</item>
13+
<item name="shard_one" xsi:type="string">shard_one</item>
14+
<item name="shard_two" xsi:type="string">shard_two</item>
15+
</argument>
16+
</arguments>
17+
</type>
18+
</config>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9+
<module name="Magento_TestSetupDeclarationModule2" setup_version="2.0.1"/>
10+
</config>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
return [
7+
'test_table_one' => 'CREATE TABLE `test_table_one` (
8+
`smallint` smallint(6) NOT NULL AUTO_INCREMENT,
9+
`varchar` varchar(254) DEFAULT NULL,
10+
PRIMARY KEY (`smallint`)
11+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
12+
'test_table_two' => 'CREATE TABLE `test_table_two` (
13+
`smallint` smallint(6) NOT NULL AUTO_INCREMENT,
14+
`varchar` varchar(254) DEFAULT NULL,
15+
PRIMARY KEY (`smallint`)
16+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
17+
'reference_table' => 'CREATE TABLE `reference_table` (
18+
`tinyint_ref` tinyint(4) NOT NULL AUTO_INCREMENT,
19+
`tinyint_without_padding` tinyint(4) NOT NULL DEFAULT 0,
20+
`bigint_without_padding` bigint(20) NOT NULL DEFAULT 0,
21+
`smallint_without_padding` smallint(6) NOT NULL DEFAULT 0,
22+
`integer_without_padding` int(11) NOT NULL DEFAULT 0,
23+
`smallint_with_big_padding` smallint(6) NOT NULL DEFAULT 0,
24+
`smallint_without_default` smallint(6) DEFAULT NULL,
25+
`int_without_unsigned` int(11) DEFAULT NULL,
26+
`int_unsigned` int(10) unsigned DEFAULT NULL,
27+
`bigint_default_nullable` bigint(20) unsigned DEFAULT 1,
28+
`bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL,
29+
PRIMARY KEY (`tinyint_ref`)
30+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
31+
'auto_increment_test' => 'CREATE TABLE `auto_increment_test` (
32+
`int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT,
33+
`int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0,
34+
UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`)
35+
) ENGINE=InnoDB DEFAULT CHARSET=utf8'
36+
];
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
return [
7+
'test_table_one' => 'CREATE TABLE `test_table_one` (
8+
`smallint` smallint NOT NULL AUTO_INCREMENT,,
9+
`varchar` varchar(254) DEFAULT NULL,
10+
PRIMARY KEY (`smallint`)
11+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
12+
'test_table_two' => 'CREATE TABLE `test_table_two` (
13+
`smallint` smallint NOT NULL AUTO_INCREMENT,,
14+
`varchar` varchar(254) DEFAULT NULL,
15+
PRIMARY KEY (`smallint`)
16+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
17+
'reference_table' => 'CREATE TABLE `reference_table` (
18+
`tinyint_ref` tinyint NOT NULL AUTO_INCREMENT,
19+
`tinyint_without_padding` tinyint NOT NULL DEFAULT \'0\',
20+
`bigint_without_padding` bigint NOT NULL DEFAULT \'0\',
21+
`smallint_without_padding` smallint NOT NULL DEFAULT \'0\',
22+
`integer_without_padding` int NOT NULL DEFAULT \'0\',
23+
`smallint_with_big_padding` smallint NOT NULL DEFAULT \'0\',
24+
`smallint_without_default` smallint DEFAULT NULL,
25+
`int_without_unsigned` int DEFAULT NULL,
26+
`int_unsigned` int unsigned DEFAULT NULL,
27+
`bigint_default_nullable` bigint unsigned DEFAULT \'1\',
28+
`bigint_not_default_not_nullable` bigint unsigned NOT NULL,
29+
PRIMARY KEY (`tinyint_ref`)
30+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
31+
'auto_increment_test' => 'CREATE TABLE `auto_increment_test` (
32+
`int_auto_increment_with_nullable` int unsigned NOT NULL AUTO_INCREMENT,
33+
`int_disabled_auto_increment` smallint unsigned DEFAULT \'0\',
34+
UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`)
35+
) ENGINE=InnoDB DEFAULT CHARSET=utf8'
36+
];
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
return [
7+
'test_table_one' => 'CREATE TABLE `test_table_one` (
8+
`smallint` smallint(6) NOT NULL AUTO_INCREMENT,
9+
`varchar` varchar(254) DEFAULT NULL,
10+
PRIMARY KEY (`smallint`)
11+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
12+
'test_table_two' => 'CREATE TABLE `test_table_two` (
13+
`smallint` smallint(6) NOT NULL AUTO_INCREMENT,
14+
`varchar` varchar(254) DEFAULT NULL,
15+
PRIMARY KEY (`smallint`)
16+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
17+
'reference_table' => 'CREATE TABLE `reference_table` (
18+
`tinyint_ref` tinyint(4) NOT NULL AUTO_INCREMENT,
19+
`tinyint_without_padding` tinyint(4) NOT NULL DEFAULT \'0\',
20+
`bigint_without_padding` bigint(20) NOT NULL DEFAULT \'0\',
21+
`smallint_without_padding` smallint(6) NOT NULL DEFAULT \'0\',
22+
`integer_without_padding` int(11) NOT NULL DEFAULT \'0\',
23+
`smallint_with_big_padding` smallint(6) NOT NULL DEFAULT \'0\',
24+
`smallint_without_default` smallint(6) DEFAULT NULL,
25+
`int_without_unsigned` int(11) DEFAULT NULL,
26+
`int_unsigned` int(10) unsigned DEFAULT NULL,
27+
`bigint_default_nullable` bigint(20) unsigned DEFAULT \'1\',
28+
`bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL,
29+
PRIMARY KEY (`tinyint_ref`)
30+
) ENGINE=InnoDB DEFAULT CHARSET=utf8',
31+
'auto_increment_test' => 'CREATE TABLE `auto_increment_test` (
32+
`int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT,
33+
`int_disabled_auto_increment` smallint(5) unsigned DEFAULT \'0\',
34+
UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`)
35+
) ENGINE=InnoDB DEFAULT CHARSET=utf8'
36+
];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
9+
$registrar = new ComponentRegistrar();
10+
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule2') === null) {
11+
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule2', __DIR__);
12+
}

dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule6/etc/db_schema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
10-
<table name="reference_table" resource="sales">
10+
<table name="reference_table" resource="default">
1111
<column xsi:type="tinyint" name="tinyint_ref" padding="7" nullable="false" identity="true" unsigned="false"/>
1212
<column xsi:type="tinyint" name="tinyint_without_padding" default="0" nullable="false" unsigned="false"/>
1313
<column xsi:type="bigint" name="bigint_without_padding" default="0" nullable="false" unsigned="false"/>

0 commit comments

Comments
 (0)