Skip to content

Commit 1044a8a

Browse files
Merge pull request #115 from ctidigital/configurator-3.x
Configurator 3
2 parents ce00f41 + 6270399 commit 1044a8a

File tree

87 files changed

+1896
-2191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1896
-2191
lines changed

.travis.yml

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
dist: trusty
22
language: php
33
php:
4-
- 7.0
5-
- 7.1
4+
- 7.2
5+
- 7.3
66
services:
77
- mysql
88
sudo: required
@@ -11,32 +11,34 @@ env:
1111
- TEST_SUITE=unit
1212
- TEST_SUITE=phpcs
1313
- TEST_SUITE=configurator
14-
MAGE_VERSION=2.1.15
14+
MAGE_VERSION=2.2.5
1515
- TEST_SUITE=configurator
16-
MAGE_VERSION=2.2.4
16+
MAGE_VERSION=2.3.1
1717
- TEST_SUITE=configurator
18-
MAGE_VERSION=2.2.5
18+
MAGE_VERSION=2.3.2
1919
- TEST_SUITE=configurator
20-
MAGE_VERSION=2.2.6
20+
MAGE_VERSION=2.3.3
2121

2222
matrix:
2323
allow_failures:
24-
- php: 7.0
25-
- env: TEST_SUITE=configurator MAGE_VERSION=2.1.15
24+
- php: 7.2
25+
- env: TEST_SUITE=configurator MAGE_VERSION=2.2.5
26+
- env: TEST_SUITE=configurator MAGE_VERSION=2.3.1
27+
- env: TEST_SUITE=configurator MAGE_VERSION=2.3.2
2628

2729
before_install:
2830
- echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json
29-
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then composer require magento/framework:~101.0.0; fi"
30-
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/framework:~101.0.0; fi"
31-
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/module-catalog:~102.0.0; fi"
32-
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/zendframework1:~1.13.0; fi"
31+
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then composer require magento/framework:^102.0.3; fi"
32+
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/framework:^102.0.3; fi"
33+
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/module-catalog; fi"
34+
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/zendframework1; fi"
3335
install:
3436
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then composer install --prefer-dist; fi"
3537
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer install --prefer-dist; fi"
3638
before_script:
3739
- sh -c "if [ '$TEST_SUITE' = 'configurator' ]; then ./Test/Integration/setup-magento.sh $MAGE_VERSION; fi"
3840
script:
39-
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then php vendor/bin/phpcs --standard=PSR2 Model/ Console/ Test/ Component/ Api/ Exception/; fi"
41+
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then php vendor/bin/phpcs --standard=vendor/magento/magento-coding-standard/Magento2/ruleset.xml Model/ Console/ Test/ Component/ Api/ Exception/; fi"
4042
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then php vendor/bin/phpmd Model/,Console/,Test/,Component/,Api/,Exception/ text cleancode,codesize,controversial,design,naming,unusedcode; fi"
4143
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then php vendor/bin/phpcpd Model/ Console/ Test/ Component/ Api/ Exception/; fi"
4244
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/phpunit --coverage-clover build/logs/clover.xml Test/Unit/; fi"

Api/ComponentInterface.php

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace CtiDigital\Configurator\Api;
4+
5+
interface ComponentInterface
6+
{
7+
/**
8+
* @param array $data
9+
* @return void
10+
*/
11+
public function execute($data);
12+
13+
/**
14+
* @return string
15+
*/
16+
public function getAlias();
17+
18+
/**
19+
* @return string
20+
*/
21+
public function getDescription();
22+
}

Api/ComponentListInterface.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace CtiDigital\Configurator\Api;
4+
5+
interface ComponentListInterface
6+
{
7+
/**
8+
* @param $componentAlias
9+
* @return ComponentInterface|bool
10+
*/
11+
public function getComponent($componentAlias);
12+
13+
/**
14+
* @return ComponentInterface[]
15+
*/
16+
public function getAllComponents();
17+
}

Api/FileComponentInterface.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
namespace CtiDigital\Configurator\Api;
3+
4+
interface FileComponentInterface extends ComponentInterface
5+
{
6+
7+
}

Component/AdminRoles.php

+29-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
namespace CtiDigital\Configurator\Component;
33

4+
use CtiDigital\Configurator\Api\ComponentInterface;
5+
use CtiDigital\Configurator\Exception\ComponentException;
6+
use CtiDigital\Configurator\Api\LoggerInterface;
47
use Magento\Authorization\Model\RoleFactory;
5-
use Magento\Framework\ObjectManagerInterface;
68
use Magento\Authorization\Model\RulesFactory;
7-
use CtiDigital\Configurator\Api\LoggerInterface;
89
use Magento\Authorization\Model\UserContextInterface;
910
use Magento\Authorization\Model\Acl\Role\Group as RoleGroup;
10-
use CtiDigital\Configurator\Exception\ComponentException;
1111

12-
class AdminRoles extends YamlComponentAbstract
12+
class AdminRoles implements ComponentInterface
1313
{
1414
protected $alias = 'adminroles';
1515
protected $name = 'Admin Roles';
@@ -29,31 +29,31 @@ class AdminRoles extends YamlComponentAbstract
2929
*/
3030
protected $rulesFactory;
3131

32+
/**
33+
* @var LoggerInterface
34+
*/
35+
private $log;
36+
3237
/**
3338
* AdminRoles constructor.
34-
* @param LoggerInterface $log
35-
* @param ObjectManagerInterface $objectManager
3639
* @param RoleFactory $roleFactory
3740
* @param RulesFactory $rulesFactory
3841
*/
3942
public function __construct(
40-
LoggerInterface $log,
41-
ObjectManagerInterface $objectManager,
4243
RoleFactory $roleFactory,
43-
RulesFactory $rulesFactory
44+
RulesFactory $rulesFactory,
45+
LoggerInterface $log
4446
) {
45-
parent::__construct($log, $objectManager);
46-
4747
$this->roleFactory = $roleFactory;
4848
$this->rulesFactory = $rulesFactory;
49+
$this->log = $log;
4950
}
5051

5152
/**
5253
* @param $data
5354
*/
54-
protected function processData($data = null)
55+
public function execute($data = null)
5556
{
56-
5757
if (isset($data['adminroles'])) {
5858
foreach ($data['adminroles'] as $role) {
5959
try {
@@ -128,4 +128,20 @@ private function setResourceIds($role, array $resources = null)
128128
sprintf('Admin Role "%s" Resources are empty, please check your yaml file', $roleName)
129129
);
130130
}
131+
132+
/**
133+
* @return string
134+
*/
135+
public function getAlias()
136+
{
137+
return $this->alias;
138+
}
139+
140+
/**
141+
* @return string
142+
*/
143+
public function getDescription()
144+
{
145+
return $this->description;
146+
}
131147
}

Component/AdminUsers.php

+28-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22
namespace CtiDigital\Configurator\Component;
33

4-
use Symfony\Component\Yaml\Yaml;
4+
use CtiDigital\Configurator\Api\ComponentInterface;
55
use Magento\User\Model\UserFactory;
66
use Magento\Authorization\Model\RoleFactory;
7-
use Magento\Framework\ObjectManagerInterface;
87
use CtiDigital\Configurator\Api\LoggerInterface;
98
use CtiDigital\Configurator\Exception\ComponentException;
109

11-
class AdminUsers extends YamlComponentAbstract
10+
class AdminUsers implements ComponentInterface
1211
{
1312
protected $alias = 'adminusers';
1413
protected $name = 'Admin Users';
@@ -28,29 +27,31 @@ class AdminUsers extends YamlComponentAbstract
2827
*/
2928
protected $roleFactory;
3029

30+
/**
31+
* @var LoggerInterface
32+
*/
33+
private $log;
34+
3135
/**
3236
* AdminUsers constructor.
33-
* @param LoggerInterface $log
34-
* @param ObjectManagerInterface $objectManager
3537
* @param UserFactory $userFactory
3638
* @param RoleFactory $roleFactory
39+
* @param LoggerInterface $log
3740
*/
3841
public function __construct(
39-
LoggerInterface $log,
40-
ObjectManagerInterface $objectManager,
4142
UserFactory $userFactory,
42-
RoleFactory $roleFactory
43+
RoleFactory $roleFactory,
44+
LoggerInterface $log
4345
) {
44-
parent::__construct($log, $objectManager);
45-
4646
$this->userFactory = $userFactory;
4747
$this->roleFactory = $roleFactory;
48+
$this->log = $log;
4849
}
4950

5051
/**
5152
* @param data
5253
*/
53-
protected function processData($data = null)
54+
public function execute($data = null)
5455
{
5556
//Get Each Role
5657
foreach ($data['adminusers'] as $roleSet) {
@@ -171,4 +172,20 @@ private function dataValidator($userData)
171172

172173
return true;
173174
}
175+
176+
/**
177+
* @return string
178+
*/
179+
public function getAlias()
180+
{
181+
return $this->alias;
182+
}
183+
184+
/**
185+
* @return string
186+
*/
187+
public function getDescription()
188+
{
189+
return $this->description;
190+
}
174191
}

Component/ApiIntegrations.php

+28-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
namespace CtiDigital\Configurator\Component;
33

4-
use Magento\Framework\ObjectManagerInterface;
4+
use CtiDigital\Configurator\Api\ComponentInterface;
55
use Magento\Integration\Model\IntegrationFactory;
66
use Magento\Integration\Model\Oauth\TokenFactory;
77
use CtiDigital\Configurator\Api\LoggerInterface;
88
use Magento\Integration\Model\AuthorizationService;
99
use Magento\Integration\Api\IntegrationServiceInterface;
1010
use CtiDigital\Configurator\Exception\ComponentException;
1111

12-
class ApiIntegrations extends YamlComponentAbstract
12+
class ApiIntegrations implements ComponentInterface
1313
{
1414
protected $alias = 'apiintegrations';
1515
protected $name = 'Api Integrations';
@@ -35,35 +35,37 @@ class ApiIntegrations extends YamlComponentAbstract
3535
*/
3636
protected $tokenFactory;
3737

38+
/**
39+
* @var LoggerInterface
40+
*/
41+
protected $log;
42+
3843
/**
3944
* ApiIntegrations constructor.
40-
* @param LoggerInterface $log
41-
* @param ObjectManagerInterface $objectManager
4245
* @param IntegrationFactory $integrationFactory
4346
* @param IntegrationServiceInterface $integrationService
4447
* @param AuthorizationService $authorizationService
4548
* @param TokenFactory $tokenFactory
49+
* @param LoggerInterface $log
4650
*/
4751
public function __construct(
48-
LoggerInterface $log,
49-
ObjectManagerInterface $objectManager,
5052
IntegrationFactory $integrationFactory,
5153
IntegrationServiceInterface $integrationService,
5254
AuthorizationService $authorizationService,
53-
TokenFactory $tokenFactory
55+
TokenFactory $tokenFactory,
56+
LoggerInterface $log
5457
) {
55-
parent::__construct($log, $objectManager);
56-
5758
$this->integrationFactory = $integrationFactory;
5859
$this->integrationService = $integrationService;
5960
$this->authorizationService = $authorizationService;
6061
$this->tokenFactory = $tokenFactory;
62+
$this->log = $log;
6163
}
6264

6365
/**
6466
* @param array $data
6567
*/
66-
protected function processData($data = null)
68+
public function execute($data = null)
6769
{
6870
if (isset($data['apiintegrations'])) {
6971
foreach ($data['apiintegrations'] as $integrationData) {
@@ -166,4 +168,20 @@ private function activateAndAuthorize($consumerId)
166168
$token->setType('access');
167169
$token->save();
168170
}
171+
172+
/**
173+
* @return string
174+
*/
175+
public function getAlias()
176+
{
177+
return $this->alias;
178+
}
179+
180+
/**
181+
* @return string
182+
*/
183+
public function getDescription()
184+
{
185+
return $this->description;
186+
}
169187
}

0 commit comments

Comments
 (0)