Skip to content

Commit

Permalink
Merge pull request #94 from ctidigital/2.2-alpha
Browse files Browse the repository at this point in the history
2.2 alpha
  • Loading branch information
chevli authored Oct 17, 2018
2 parents b3ad466 + fd5b545 commit 455fdd7
Show file tree
Hide file tree
Showing 66 changed files with 541 additions and 332 deletions.
22 changes: 12 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dist: trusty
language: php
php:
- 7.0
- 7.1
services:
- mysql
sudo: required
Expand All @@ -10,23 +11,24 @@ env:
- TEST_SUITE=unit
- TEST_SUITE=phpcs
- TEST_SUITE=configurator
MAGE_VERSION=2.1.8
MAGE_VERSION=2.1.15
- TEST_SUITE=configurator
MAGE_VERSION=2.1.9
MAGE_VERSION=2.2.4
- TEST_SUITE=configurator
MAGE_VERSION=2.1.10
MAGE_VERSION=2.2.5
- TEST_SUITE=configurator
MAGE_VERSION=2.2.1
MAGE_VERSION=2.2.6

matrix:
allow_failures:
- env: TEST_SUITE=configurator MAGE_VERSION=2.2.1
- php: 7.0
- env: TEST_SUITE=configurator MAGE_VERSION=2.1.15

before_install:
- echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGENTO_USERNAME}\",\"password\":\"${MAGENTO_PASSWORD}\"}}}" > auth.json
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then composer require magento/framework:~100.1.0; fi"
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/framework:~100.1.0; fi"
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/module-catalog:~101.0.0; fi"
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then composer require magento/framework:~101.0.0; fi"
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/framework:~101.0.0; fi"
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/module-catalog:~102.0.0; fi"
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then composer require magento/zendframework1:~1.13.0; fi"
install:
- sh -c "if [ '$TEST_SUITE' = 'phpcs' ]; then composer install --prefer-dist; fi"
Expand All @@ -40,6 +42,6 @@ script:
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then php vendor/bin/phpunit --coverage-clover build/logs/clover.xml Test/Unit/; fi"
- sh -c "if [ '$TEST_SUITE' = 'configurator' ]; then ./Test/Integration/run-configurator.sh; fi"
notifications:
hipchat:
slack:
rooms:
secure: bM2ia9UiRcc/nudnEuU0fib564KScItsMG+RAJuTfOfhGrkoxW1RGOFHl75WVUupv4BswNyvUQezU+NQn6clRojfhOvVVJeN2GPPfh0Tl7ClmkOqNl5Uyooxt4wg9Gn+bu0Cl9uLHA9IaANR5Z1j+c9EBNnacOOdjPamHEAPH7Aw9n+mN3kx77NUe/uJmdUbqUUyuCzFz86zPNYT4cxDlFEGu8HpM6HC88DyUb6q0ZbeVH16YdZwNLgS15AlKiN2ZiqGnDiU8GxCdSHFg/JZ3bqY154ZH3IGnqAe0/FURErch5DNqTBhjqaqidTZyuZrST3sxq9+M3K7VkuiWLTVDQ7+FIrHk2t2Xu8obd5geTeLieBUarG5P7vGCerDR8XLwGXzEaihiG6jcb1MN/trDQdofABXc0zOtkTW1C1R+byBhCZIBITIk5rPyvKO9aVgl/MEqqYvh14JBpXrfFqOuxGTpoOKCwXVL6BzaB6EIh5aD6yWQx2rqaXUGAl1NBolBdMBJNLPXI5WeknWSpL83gMegrVbixH6si9ivynkpo/Thq8vERXVVM8RRKlD8b9/Yhep5vJCFA33uweNX6Y1k+7uEVara3OQnKHUiF5Fh4YnozYX7L8lSKOhhGJU+zg76ANyfVXIUY4WSIgsUMEAPA4GmfusNMPb0HxIOs+FJwI=
secure: BWl/riMVP1ANjN0GyVdgBslI+eK5sz7g3s2fQtyyq7SPgWjrz5XpU0a5TcSQWa12wseY1mS09ln0UUMDYvpXucBhIqnB4LMYFHJyeKSbp232L+mQ6INM7xgBkwzsAtdQ8UqFSPWPbpUW+7Ah2DLEo2RSSfbvZIHD4ylEUJ0xDjOUzZicLdUbPSLO1NZV9JfHYHAHnsudRskoPVQ53dSSy3j5i9g9iDMTQAjzDAWRW8fEFWxfnyuggMA4Quwi+jUxOH38L6BsmZfje6K54dfBTcmTHHTxdinbOHiem9jSN/dDxp6EXSLTCxX4+qtd8ix/KRUTXj0BJbamO/HgzgYhSBjTwsJjwvnjCwnhNgsL08e8nxIEOmXrMxddMUJK9Qh8Rt5DzGTxSs2B+GRfuiFTAuwjI166k3wkxDnYrltxmvl4L8icoCsd7rVTNnwWNvPBdKkOB6tE1lGu98hIcGZ1lbPE14+oRFATpnanDiGffFgdxEbyDeQBRc4aqZYgFd2lR5SRRdy1p6ysQAJNDRGp/nIqzctLrrBYeGOcVk0WOpYmzUTVMIWiYrI36l4Hv+OJ+x+Aei7GJfBozVRu+/BPWx3RUNvt67c2flc/OPFhzX75yc+zJUsAy2yWN/qW6wJmzEc/wU2IIFL/EKIQl7dD02pdXXBxk0d9thy1GWK4exk=
1 change: 0 additions & 1 deletion Component/AdminRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,5 @@ private function setResourceIds($role, array $resources = null)
$this->log->logError(
sprintf('Admin Role "%s" Resources are empty, please check your yaml file', $roleName)
);

}
}
3 changes: 0 additions & 3 deletions Component/AdminUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected function processData($data = null)
{
//Get Each Role
foreach ($data['adminusers'] as $roleSet) {

$roleName = $roleSet['rolename'];
$roleId = $this->getUserRoleFromName($roleName);

Expand All @@ -68,15 +67,13 @@ protected function processData($data = null)

//Run through users in this Role
foreach ($roleSet['users'] as $userData) {

$validData = $this->dataValidator($userData);
try {
if (!$validData) {
return;
}

$this->createAdminUser($userData, $roleId);

} catch (\Magento\Framework\Validator\Exception $e) {
$this->log->logError(sprintf('Magento Framework Validation Exception: %s', $e->getMessage()));
} catch (ComponentException $e) {
Expand Down
2 changes: 0 additions & 2 deletions Component/ApiIntegrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ protected function processData($data = null)
}

$this->createApiIntegration($integrationData);

} catch (ComponentException $e) {
$this->log->logError($e->getMessage());
}
Expand All @@ -95,7 +94,6 @@ private function createApiIntegration(array $integrationData)
->getSize();

if ($integrationCount > 0) {

$integration = $integration
->getCollection()
->addFieldToFilter('name', $integrationData['name'])
Expand Down
5 changes: 1 addition & 4 deletions Component/AttributeSets.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ protected function addAttributeGroups(AttributeSetInterface $attributeSetEntity,

// Loop through the groups that belong to the attribute set
foreach ($attributeGroupData as $group) {

try {
// Used to predetermine the code if not using a custom attribute group code
if (!isset($group['code'])) {
Expand All @@ -124,7 +123,6 @@ protected function addAttributeGroups(AttributeSetInterface $attributeSetEntity,

// Attempt to associate the attributes to the group
$this->addAttributeGroupAssociations($attributeSetEntity, $group);

} catch (\Zend_Db_Statement_Exception $exception) {
$this->log->logError(
'Magento sometimes uses different attribute codes to attribute names. '
Expand All @@ -137,7 +135,6 @@ protected function addAttributeGroups(AttributeSetInterface $attributeSetEntity,
);
$this->log->logError($exception->getMessage(), 1);
}

}
}

Expand All @@ -159,7 +156,7 @@ protected function addAttributeGroupAssociations(
$this->eavSetup->addAttributeToGroup(
Product::ENTITY,
$attributeSetEntity->getId(),
$group['code'],
$group['name'],
$attributeCode
);

Expand Down
5 changes: 2 additions & 3 deletions Component/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use CtiDigital\Configurator\Exception\ComponentException;
use CtiDigital\Configurator\Api\LoggerInterface;
use Magento\Catalog\Model\Product;
use Magento\Eav\Api\AttributeRepositoryInterface;
use Magento\Eav\Setup\EavSetup;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\ObjectManagerInterface;
use Magento\Eav\Model\AttributeRepository;

/**
* Class Attributes
Expand Down Expand Up @@ -78,7 +78,7 @@ public function __construct(
LoggerInterface $log,
ObjectManagerInterface $objectManager,
EavSetup $eavSetup,
AttributeRepository $attributeRepository
AttributeRepositoryInterface $attributeRepository
) {
parent::__construct($log, $objectManager);
$this->eavSetup = $eavSetup;
Expand Down Expand Up @@ -120,7 +120,6 @@ protected function processAttribute($attributeCode, array $attributeConfig)
}

if ($updateAttribute) {

if (!array_key_exists('user_defined', $attributeConfig)) {
$attributeConfig['user_defined'] = 1;
}
Expand Down
14 changes: 0 additions & 14 deletions Component/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ public function __construct(
ObjectManagerInterface $objectManager,
BlockInterfaceFactory $blockFactory
) {

parent::__construct($log, $objectManager);

$this->blockFactory = $blockFactory;
$this->storeManager = $this->objectManager->create(\Magento\Store\Model\Store::class);

}

/**
Expand All @@ -54,11 +52,9 @@ public function __construct(
protected function processData($data = null)
{
try {

foreach ($data as $identifier => $data) {
$this->processBlock($identifier, $data);
}

} catch (ComponentException $e) {
$this->log->logError($e->getMessage());
}
Expand All @@ -72,10 +68,8 @@ protected function processData($data = null)
private function processBlock($identifier, $blockData)
{
try {

// Loop through the block data
foreach ($blockData['block'] as $data) {

$this->log->logComment(sprintf("Checking for existing blocks with identifier '%s'", $identifier));

// Load a collection blocks
Expand Down Expand Up @@ -107,7 +101,6 @@ private function processBlock($identifier, $blockData)

// Loop through each attribute of the data array
foreach ($data as $key => $value) {

// Check if content is from a file source
if ($key == "source") {
$key = 'content';
Expand All @@ -130,7 +123,6 @@ private function processBlock($identifier, $blockData)

// Check if there is a difference in value
if ($block->getData($key) != $value) {

// If there is, allow the block to be saved
$canSave = true;
$block->setData($key, $value);
Expand Down Expand Up @@ -165,7 +157,6 @@ private function processBlock($identifier, $blockData)
$identifier . ' (' . $block->getId() . ')'
));
}

}
} catch (ComponentException $e) {
$this->log->logError($e->getMessage());
Expand All @@ -186,17 +177,14 @@ private function getBlockToProcess(
\Magento\Cms\Model\ResourceModel\Block\Collection $blocks,
$stores = array()
) {

// If there is only 1 block and stores hasn't been specified
if ($blocks->count() == 1 && count($stores) == 0) {

// Return that one block
return $blocks->getFirstItem();
}

// If we do have stores specified
if (count($stores) > 0) {

// Use first store as filter to get the block ID.
// Ideally, we would want to do something more intelligent here.
$store = $this->getStoreByCode($stores[0]);
Expand All @@ -220,13 +208,11 @@ private function getBlockToProcess(
*/
private function getStoreByCode($code)
{

// Load the store object
$store = $this->storeManager->load($code, 'code');

// Check if we get back a store ID.
if (!$store->getId()) {

// If not, stop the process by throwing an exception
throw new ComponentException(sprintf("No store with code '%s' found", $code));
}
Expand Down
2 changes: 0 additions & 2 deletions Component/CatalogPriceRules/CatalogPriceRulesProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public function process()

// Check to see we only have one of those rules by name
if ($ruleCollection->getSize() > 1) {

// Log an error and skip if there are more than 1 rules
$this->logger->logError(sprintf(
'There appears to be more than 1 rule in Magento with the name "%s."',
Expand Down Expand Up @@ -164,7 +163,6 @@ private function fillRuleWithData(Rule $rule, array $ruleData)
{
// Loop through each key value
foreach ($ruleData as $key => $value) {

// Check if they're the same as what is on the database
// If so, skip to the next key value pair
if ($rule->getData($key) == $value) {
Expand Down
4 changes: 0 additions & 4 deletions Component/ComponentAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ public function getDescription()
*/
public function process()
{

try {

// Check if a component can be parsed and processed
if (!$this->canParseAndProcess()) {
return; // @todo show some kind of logging
Expand Down Expand Up @@ -107,11 +105,9 @@ public function process()

// $this->eventManager->dispatch('configurator_process_component_after',array('object'=>$this));
// $this->eventManager->dispatch('configurator_process_component_after'.$this->alias,array('object'=>$this));

} catch (ComponentException $e) {
$this->log->logError($e->getMessage());
}

}

/**
Expand Down
Loading

0 comments on commit 455fdd7

Please sign in to comment.