Skip to content

Commit 16b7775

Browse files
AC-13182::[Upgrade Build] Manual Upgrade Build 2.4.7-p2 -> 2.4.8-beta1-Revert Changes
1 parent d03701a commit 16b7775

File tree

2 files changed

+6
-58
lines changed

2 files changed

+6
-58
lines changed

lib/internal/Magento/Framework/Mview/Config/Converter.php

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22
/**
3-
* Copyright 2014 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
namespace Magento\Framework\Mview\Config;
77

88
use Magento\Framework\Mview\View\AdditionalColumnsProcessor\DefaultProcessor;
99
use Magento\Framework\Mview\View\ChangelogBatchWalker;
1010
use Magento\Framework\Mview\View\SubscriptionInterface;
11-
use Magento\Framework\App\ResourceConnection;
1211

1312
class Converter implements \Magento\Framework\Config\ConverterInterface
1413
{
@@ -23,21 +22,13 @@ class Converter implements \Magento\Framework\Config\ConverterInterface
2322
private $defaultIterator;
2423

2524
/**
26-
* @var ResourceConnection
27-
*/
28-
private $resourceConnection;
29-
30-
/**
31-
* @param ResourceConnection $resourceConnection
3225
* @param string $defaultProcessor
3326
* @param string $defaultIterator
3427
*/
3528
public function __construct(
36-
ResourceConnection $resourceConnection,
3729
string $defaultProcessor = DefaultProcessor::class,
3830
string $defaultIterator = ChangelogBatchWalker::class
3931
) {
40-
$this->resourceConnection = $resourceConnection;
4132
$this->defaultProcessor = $defaultProcessor;
4233
$this->defaultIterator = $defaultIterator;
4334
}
@@ -108,15 +99,7 @@ protected function convertChild(\DOMNode $childNode, $data)
10899
continue;
109100
}
110101
$name = $this->getAttributeValue($subscription, 'name');
111-
$configColumn = $this->getAttributeValue($subscription, 'entity_column');
112-
$column = $this->checkifcolumnexist($name, $configColumn);
113-
114-
if (empty($column)) {
115-
throw new \InvalidArgumentException(
116-
'Column ' . $configColumn . ' does not exist in table ' . $name
117-
);
118-
}
119-
102+
$column = $this->getAttributeValue($subscription, 'entity_column');
120103
$subscriptionModel = $this->getAttributeValue($subscription, 'subscription_model');
121104

122105
if (!empty($subscriptionModel)
@@ -172,23 +155,4 @@ private function getAdditionalColumns(\DOMNode $subscription): array
172155

173156
return $additionalColumns;
174157
}
175-
176-
/**
177-
* Check if column exists in table, otherwise return primary key column
178-
*
179-
* @param string $tableName
180-
* @param string $columnName
181-
* @return string
182-
*/
183-
public function checkifcolumnexist($tableName, $columnName) : string
184-
{
185-
$connection = $this->resourceConnection->getConnection();
186-
$tableName = $this->resourceConnection->getTableName($tableName);
187-
188-
if (!$connection->isTableExists($tableName) || $connection->tableColumnExists($tableName, $columnName)) {
189-
return $columnName;
190-
}
191-
192-
return '';
193-
}
194158
}

lib/internal/Magento/Framework/Mview/Test/Unit/Config/ConverterTest.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<?php
22
/**
3-
* Copyright 2015 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

88
namespace Magento\Framework\Mview\Test\Unit\Config;
99

10-
use Magento\Framework\App\ResourceConnection;
11-
use Magento\Framework\DB\Adapter\AdapterInterface;
1210
use Magento\Framework\Mview\Config\Converter;
1311
use PHPUnit\Framework\MockObject\MockObject;
1412
use PHPUnit\Framework\TestCase;
@@ -20,27 +18,13 @@ class ConverterTest extends TestCase
2018
*/
2119
protected $_model;
2220

23-
/**
24-
* @var ResourceConnection|MockObject
25-
*/
26-
protected $resourceConnectionMock;
27-
28-
/**
29-
* @var \Magento\Framework\DB\Adapter\AdapterInterface|MockObject
30-
*/
31-
protected $connectionMock;
32-
3321
protected function setUp(): void
3422
{
35-
$this->connectionMock = $this->createMock(AdapterInterface::class);
36-
$this->resourceConnectionMock = $this->createMock(ResourceConnection::class);
37-
$this->_model = new Converter($this->resourceConnectionMock);
23+
$this->_model = new Converter();
3824
}
3925

4026
public function testConvert()
4127
{
42-
$this->resourceConnectionMock->method('getConnection')
43-
->willReturn($this->connectionMock);
4428
$data = include __DIR__ . '/../_files/mview_config.php';
4529
$dom = new \DOMDocument();
4630
$dom->loadXML($data['inputXML']);

0 commit comments

Comments
 (0)