Skip to content

Commit c156622

Browse files
committed
MAGETWO-34528: Contribution of Sprint 24 Work to Mainline
- fixing merging issues
1 parent c374620 commit c156622

File tree

8 files changed

+40
-25
lines changed

8 files changed

+40
-25
lines changed

app/code/Magento/Webapi/Model/Plugin/Manager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
*/
66
namespace Magento\Webapi\Model\Plugin;
77

8-
use Magento\Integration\Model\Integration;
8+
use Magento\Integration\Model\ConfigBasedIntegrationManager;
99
use Magento\Integration\Service\V1\AuthorizationServiceInterface as IntegrationAuthorizationInterface;
1010
use Magento\Webapi\Model\IntegrationConfig;
1111

1212
/**
13-
* Plugin for \Magento\Integration\Model\Manager model to manage resource permissions of
13+
* Plugin for ConfigBasedIntegrationManager model to manage resource permissions of
1414
* integration installed from config file
1515
*/
1616
class Manager
@@ -54,14 +54,14 @@ public function __construct(
5454
/**
5555
* Process integration resource permissions after the integration is created
5656
*
57-
* @param \Magento\Integration\Model\Manager $subject
57+
* @param ConfigBasedIntegrationManager $subject
5858
* @param string[] $integrationNames Name of integrations passed as array from the invocation chain
5959
*
6060
* @return string[]
6161
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6262
*/
6363
public function afterProcessIntegrationConfig(
64-
\Magento\Integration\Model\Manager $subject,
64+
ConfigBasedIntegrationManager $subject,
6565
$integrationNames
6666
) {
6767
if (empty($integrationNames)) {

app/code/Magento/Webapi/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<argument name="customAttributeMap" xsi:type="object">CustomAttributeMap</argument>
3333
</arguments>
3434
</type>
35-
<type name="Magento\Integration\Model\Manager">
35+
<type name="Magento\Integration\Model\ConfigBasedIntegrationManager">
3636
<plugin name="webapiSetup" type="Magento\Webapi\Model\Plugin\Manager" />
3737
</type>
3838
</config>

dev/tests/api-functional/_files/Magento/TestModuleIntegrationFromConfig/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
9-
<module name="Magento_TestModuleIntegrationFromConfig" schema_version="0.0.1" active="true">
9+
<module name="Magento_TestModuleIntegrationFromConfig" setup_version="0.0.1" active="true">
1010
</module>
1111
</config>

dev/tests/unit/testsuite/Magento/Setup/Model/InstallerFactoryTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ public function testCreate()
7070
[
7171
'Magento\Framework\App\DeploymentConfig\Reader',
7272
$this->getMock('Magento\Framework\App\DeploymentConfig\Reader', [], [], '', false),
73-
]
73+
],
74+
[
75+
'Magento\Framework\Model\Resource\Db\TransactionManager',
76+
$this->getMock('Magento\Framework\Model\Resource\Db\TransactionManager', [], [], '', false),
77+
],
78+
[
79+
'Magento\Framework\Model\Resource\Db\ObjectRelationProcessor',
80+
$this->getMock('Magento\Framework\Model\Resource\Db\ObjectRelationProcessor', [], [], '', false),
81+
],
7482
];
7583
$serviceLocatorMock = $this->getMockForAbstractClass('Zend\ServiceManager\ServiceLocatorInterface', ['get']);
7684
$serviceLocatorMock

dev/tests/unit/testsuite/Magento/Setup/Model/InstallerTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ class InstallerTest extends \PHPUnit_Framework_TestCase
110110
];
111111

112112
/**
113-
* @var \Magento\Framework\App\Resource|\PHPUnit_Framework_MockObject_MockObject
113+
* @var Magento\Framework\Model\Resource\Db\Context|\PHPUnit_Framework_MockObject_MockObject
114114
*/
115-
private $resourceMock;
115+
private $contextMock;
116116

117117
protected function setUp()
118118
{
@@ -142,7 +142,7 @@ protected function setUp()
142142
$this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
143143
$this->sampleData = $this->getMock('Magento\Setup\Model\SampleData', [], [], '', false);
144144
$this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
145-
$this->resourceMock = $this->getMock('Magento\Framework\App\Resource', [], [], '', false);
145+
$this->contextMock = $this->getMock('Magento\Framework\Model\Resource\Db\Context', [], [], '', false);
146146
$this->object = $this->createObject();
147147
}
148148

@@ -178,7 +178,7 @@ private function createObject($connectionFactory = false, $objectManagerProvider
178178
$this->filesystem,
179179
$this->sampleData,
180180
$objectManagerProvider,
181-
$this->resourceMock
181+
$this->contextMock
182182
);
183183
}
184184

@@ -204,15 +204,17 @@ public function testInstall()
204204
$table->expects($this->any())->method('addColumn')->willReturn($table);
205205
$table->expects($this->any())->method('setComment')->willReturn($table);
206206
$connection->expects($this->any())->method('newTable')->willReturn($table);
207-
$this->resourceMock->expects($this->any())->method('getConnection')->willReturn($connection);
207+
$resource = $this->getMock('Magento\Framework\App\Resource', [], [], '', false);
208+
$this->contextMock->expects($this->any())->method('getResources')->willReturn($resource);
209+
$resource->expects($this->any())->method('getConnection')->will($this->returnValue($connection));
208210
$dataSetup = $this->getMock('Magento\Setup\Module\DataSetup', [], [], '', false);
209211
$cacheManager = $this->getMock('Magento\Framework\App\Cache\Manager', [], [], '', false);
210212
$cacheManager->expects($this->once())->method('getAvailableTypes')->willReturn(['foo', 'bar']);
211213
$cacheManager->expects($this->once())->method('setEnabled')->willReturn(['foo', 'bar']);
212214
$this->objectManager->expects($this->any())
213215
->method('create')
214216
->will($this->returnValueMap([
215-
['Magento\Setup\Module\Setup', ['resource' => $this->resourceMock], $setup],
217+
['Magento\Setup\Module\Setup', ['resource' => $resource], $setup],
216218
['Magento\Setup\Module\DataSetup', [], $dataSetup],
217219
['Magento\Framework\App\Cache\Manager', [], $cacheManager],
218220
]));

dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/ManagerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
3838
protected $apiSetupPlugin;
3939

4040
/**
41-
* @var \Magento\Integration\Model\Manager|\PHPUnit_Framework_MockObject_MockObject
41+
* @var \Magento\Integration\Model\ConfigBasedIntegrationManager|\PHPUnit_Framework_MockObject_MockObject
4242
*/
4343
protected $subjectMock;
4444

@@ -62,7 +62,7 @@ public function setUp()
6262
['grantPermissions']
6363
)->getMock();
6464

65-
$this->subjectMock = $this->getMock('Magento\Integration\Model\Manager', [], [], '', false);
65+
$this->subjectMock = $this->getMock('Magento\Integration\Model\ConfigBasedIntegrationManager', [], [], '', false);
6666
$this->apiSetupPlugin = new \Magento\Webapi\Model\Plugin\Manager(
6767
$this->integrationConfigMock,
6868
$this->integrationAuthorizationServiceMock,

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Magento\Framework\Setup\UpgradeDataInterface;
3333
use Magento\Framework\Setup\SchemaSetupInterface;
3434
use Magento\Framework\Setup\ModuleDataSetupInterface;
35+
use Magento\Framework\Model\Resource\Db\Context;
3536

3637
/**
3738
* Class Installer contains the logic to install Magento application.
@@ -201,9 +202,9 @@ class Installer
201202
private $objectManagerProvider;
202203

203204
/**
204-
* @var Resource
205+
* @var Context
205206
*/
206-
private $resource;
207+
private $context;
207208

208209
/**
209210
* Constructor
@@ -222,7 +223,7 @@ class Installer
222223
* @param Filesystem $filesystem
223224
* @param SampleData $sampleData
224225
* @param ObjectManagerProvider $objectManagerProvider
225-
* @param \Magento\Framework\App\Resource $resource
226+
* @param Context $context
226227
*
227228
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
228229
*/
@@ -241,7 +242,7 @@ public function __construct(
241242
Filesystem $filesystem,
242243
SampleData $sampleData,
243244
ObjectManagerProvider $objectManagerProvider,
244-
\Magento\Framework\App\Resource $resource
245+
Context $context
245246
) {
246247
$this->filePermissions = $filePermissions;
247248
$this->deploymentConfigWriter = $deploymentConfigWriter;
@@ -259,7 +260,7 @@ public function __construct(
259260
$this->installInfo[self::INFO_MESSAGE] = [];
260261
$this->deploymentConfig = $deploymentConfig;
261262
$this->objectManagerProvider = $objectManagerProvider;
262-
$this->resource = $resource;
263+
$this->context = $context;
263264
}
264265

265266
/**
@@ -598,7 +599,7 @@ public function installSchema()
598599
{
599600
$setup = $this->objectManagerProvider->get()->create(
600601
'Magento\Setup\Module\Setup',
601-
['resource' => $this->resource]
602+
['resource' => $this->context->getResources()]
602603
);
603604
$this->setupModuleRegistry($setup);
604605
$this->log->log('Schema creation/updates:');
@@ -639,7 +640,7 @@ private function handleDBSchemaData($setup, $type)
639640
$this->assertDeploymentConfigExists();
640641
$this->assertDbAccessible();
641642

642-
$resource = new \Magento\Framework\Module\Resource($this->resource);
643+
$resource = new \Magento\Framework\Module\Resource($this->context);
643644
$verType = $type . '-version';
644645
$installType = $type . '-install';
645646
$upgradeType = $type . '-upgrade';
@@ -733,7 +734,7 @@ private function installOrderIncrementPrefix($orderIncrementPrefix)
733734
{
734735
$setup = $this->objectManagerProvider->get()->create(
735736
'Magento\Setup\Module\Setup',
736-
['resource' => $this->resource]
737+
['resource' => $this->context->getResources()]
737738
);
738739
$dbConnection = $setup->getConnection();
739740

@@ -779,7 +780,7 @@ public function installAdminUser($data)
779780
$this->assertDeploymentConfigExists();
780781
$setup = $this->objectManagerProvider->get()->create(
781782
'Magento\Setup\Module\Setup',
782-
['resource' => $this->resource]
783+
['resource' => $this->context->getResources()]
783784
);
784785
$adminAccount = $this->adminAccountFactory->create($setup, (array)$data);
785786
$adminAccount->save();

setup/src/Magento/Setup/Model/InstallerFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ public function create(LoggerInterface $log)
5858
$this->serviceLocator->get('Magento\Framework\Filesystem'),
5959
$this->serviceLocator->get('Magento\Setup\Model\SampleData'),
6060
$this->serviceLocator->get('Magento\Setup\Model\ObjectManagerProvider'),
61-
$this->getResource()
61+
new \Magento\Framework\Model\Resource\Db\Context(
62+
$this->getResource(),
63+
$this->serviceLocator->get('Magento\Framework\Model\Resource\Db\TransactionManager'),
64+
$this->serviceLocator->get('Magento\Framework\Model\Resource\Db\ObjectRelationProcessor')
65+
)
6266
);
6367
}
6468

0 commit comments

Comments
 (0)