Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 91e10cd

Browse files
authored
Merge pull request #2788 from magento-earl-grey/MAGETWO-92929
[earl] MAGETWO-92929: Declarative schema tests are located in inappropriate place
2 parents 1d469f8 + bc16085 commit 91e10cd

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

app/code/Magento/Framework/Test/Unit/Setup/SchemaListenerTest.php renamed to lib/internal/Magento/Framework/Setup/Test/Unit/SchemaListenerTest.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

7-
namespace Magento\Framework\Test\Unit\Setup;
8+
namespace Magento\Framework\Setup\Test\Unit;
89

910
use Magento\Framework\DB\Ddl\Table;
1011
use Magento\Framework\Setup\SchemaListenerDefinition\BooleanDefinition;
@@ -16,7 +17,7 @@
1617
/**
1718
* Unit test for schema listener.
1819
*
19-
* @package Magento\Framework\Test\Unit\Setup
20+
* @package Magento\Framework\Setup\Test\Unit
2021
*/
2122
class SchemaListenerTest extends \PHPUnit\Framework\TestCase
2223
{
@@ -30,7 +31,7 @@ class SchemaListenerTest extends \PHPUnit\Framework\TestCase
3031
*/
3132
private $objectManagerHelper;
3233

33-
protected function setUp()
34+
protected function setUp() : void
3435
{
3536
$this->objectManagerHelper = new ObjectManagerHelper($this);
3637
$this->model = $this->objectManagerHelper->getObject(
@@ -51,7 +52,7 @@ protected function setUp()
5152
/**
5253
* @return Table
5354
*/
54-
private function getCreateTableDDL($tableName)
55+
private function getCreateTableDDL($tableName) : Table
5556
{
5657
$table = new Table();
5758
$table->setName($tableName);
@@ -91,7 +92,7 @@ private function getCreateTableDDL($tableName)
9192
);
9293
}
9394

94-
public function testRenameTable()
95+
public function testRenameTable() : void
9596
{
9697
$this->model->setModuleName('First_Module');
9798
$this->model->createTable($this->getCreateTableDDL('old_table'));
@@ -101,15 +102,15 @@ public function testRenameTable()
101102
self::assertArrayNotHasKey('old_table', $tables['First_Module']);
102103
}
103104

104-
public function testDropIndex()
105+
public function testDropIndex() : void
105106
{
106107
$this->model->setModuleName('First_Module');
107108
$this->model->createTable($this->getCreateTableDDL('index_table'));
108109
$this->model->dropIndex('index_table', 'INDEX_KEY', 'index');
109110
self::assertTrue($this->model->getTables()['First_Module']['index_table']['indexes']['INDEX_KEY']['disabled']);
110111
}
111112

112-
public function testCreateTable()
113+
public function testCreateTable() : void
113114
{
114115
$this->model->setModuleName('First_Module');
115116
$this->model->createTable($this->getCreateTableDDL('new_table'));
@@ -125,7 +126,7 @@ public function testCreateTable()
125126
'nullable' => false,
126127
'default' => 'CURRENT_TIMESTAMP',
127128
'disabled' => false,
128-
'onCreate' => NULL,
129+
'onCreate' => null,
129130
],
130131
'integer' =>
131132
[
@@ -135,9 +136,9 @@ public function testCreateTable()
135136
'unsigned' => false,
136137
'nullable' => false,
137138
'identity' => true,
138-
'default' => NULL,
139+
'default' => null,
139140
'disabled' => false,
140-
'onCreate' => NULL,
141+
'onCreate' => null,
141142
],
142143
'decimal' =>
143144
[
@@ -147,9 +148,9 @@ public function testCreateTable()
147148
'precision' => '25',
148149
'unsigned' => false,
149150
'nullable' => false,
150-
'default' => NULL,
151+
'default' => null,
151152
'disabled' => false,
152-
'onCreate' => NULL,
153+
'onCreate' => null,
153154
],
154155
],
155156
$tables['First_Module']['new_table']['columns']
@@ -201,7 +202,7 @@ public function testCreateTable()
201202
);
202203
}
203204

204-
public function testDropTable()
205+
public function testDropTable() : void
205206
{
206207
$this->model->setModuleName('Old_Module');
207208
$this->model->createTable($this->getCreateTableDDL('old_table'));
@@ -210,7 +211,7 @@ public function testDropTable()
210211
self::assertTrue($this->model->getTables()['New_Module']['old_table']['disabled']);
211212
}
212213

213-
public function testDropTableInSameModule()
214+
public function testDropTableInSameModule() : void
214215
{
215216
$this->model->setModuleName('Old_Module');
216217
$this->model->createTable($this->getCreateTableDDL('old_table'));

app/code/Magento/Framework/Test/Unit/Setup/SchemaPersistorTest.php renamed to lib/internal/Magento/Framework/Setup/Test/Unit/SchemaPersistorTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

7-
namespace Magento\Framework\Test\Unit\Setup;
8+
namespace Magento\Framework\Setup\Test\Unit;
89

910
use Magento\Framework\Component\ComponentRegistrar;
1011
use Magento\Framework\Setup\SchemaListener;
@@ -14,7 +15,7 @@
1415
/**
1516
* Unit test for schema persistor.
1617
*
17-
* @package Magento\Framework\Test\Unit\Setup
18+
* @package Magento\Framework\Setup\Test\Unit
1819
*/
1920
class SchemaPersistorTest extends \PHPUnit\Framework\TestCase
2021
{
@@ -38,7 +39,7 @@ class SchemaPersistorTest extends \PHPUnit\Framework\TestCase
3839
*/
3940
private $xmlPersistor;
4041

41-
protected function setUp()
42+
protected function setUp() : void
4243
{
4344
$this->componentRegistrarMock = $this->getMockBuilder(ComponentRegistrar::class)
4445
->disableOriginalConstructor()
@@ -60,7 +61,7 @@ protected function setUp()
6061
* @param array $tables
6162
* @param string $expectedXML
6263
*/
63-
public function testPersist(array $tables, $expectedXML)
64+
public function testPersist(array $tables, $expectedXML) : void
6465
{
6566
$moduleName = 'First_Module';
6667
/** @var SchemaListener|\PHPUnit_Framework_MockObject_MockObject $schemaListenerMock */
@@ -88,7 +89,7 @@ public function testPersist(array $tables, $expectedXML)
8889
*
8990
* @return array
9091
*/
91-
public function schemaListenerTablesDataProvider()
92+
public function schemaListenerTablesDataProvider() : array
9293
{
9394
return [
9495
[
@@ -143,6 +144,7 @@ public function schemaListenerTablesDataProvider()
143144
]
144145
]
145146
],
147+
// @codingStandardsIgnoreStart
146148
'XMLResult' => '<?xml version="1.0"?>
147149
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
148150
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
@@ -161,6 +163,7 @@ public function schemaListenerTablesDataProvider()
161163
</index>
162164
</table>
163165
</schema>'
166+
// @codingStandardsIgnoreEnd
164167
]
165168
];
166169
}

0 commit comments

Comments
 (0)