Skip to content

Commit

Permalink
Merge pull request #56 from spryker-middleware/bugfix/supesc-34-middl…
Browse files Browse the repository at this point in the history
…eware-requires-spryker-development

SUPESC-34 Remove invalid Development module dependency
  • Loading branch information
spryker-release-bot authored May 25, 2022
2 parents 0be9343 + b9a6d91 commit e7f1d7e
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sudo: required
matrix:
fast_finish: true
include:
- php: "7.2"
- php: "7.3"

services:
- postgresql
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"license": "proprietary",
"minimum-stability": "dev",
"require": {
"php": ">=7.2",
"php": ">=7.3",
"spryker/console": "^4.0.0",
"spryker/development": "^3.0.0",
"spryker/kernel": "^3.30.0",
"spryker/monolog": "^2.0.0",
"spryker/symfony": "^3.0.0",
"spryker/transfer": "^3.4.0",
Expand All @@ -19,8 +19,7 @@
"spryker/code-sniffer": "*",
"spryker/propel": "*",
"spryker/silex": "*",
"spryker/testify": "*",
"spryker/transfer": "*"
"spryker/testify": "*"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace SprykerMiddleware\Zed\Process\Business\Process;

use Exception;
use Generated\Shared\Transfer\ProcessResultTransfer;
use Generated\Shared\Transfer\ProcessSettingsTransfer;
use SprykerMiddleware\Shared\Logger\Logger\MiddlewareLoggerTrait;
Expand All @@ -16,6 +15,7 @@
use SprykerMiddleware\Zed\Process\Business\PluginResolver\ProcessPluginResolverInterface;
use SprykerMiddleware\Zed\Process\Business\ProcessResult\ProcessResultHelperInterface;
use SprykerMiddleware\Zed\Process\Dependency\Plugin\Stream\OptionAwareStreamPluginInterface;
use Throwable;

class Processor implements ProcessorInterface
{
Expand Down Expand Up @@ -121,7 +121,7 @@ public function process(): void
}
}
$this->outputStream->flush();
} catch (Exception $e) {
} catch (Throwable $e) {
$this->processResultHelper->increaseFailedItemCount($this->processResultTransfer);
$this->getProcessLogger()->error('Middleware process was stopped. Non tolerable error was occurred.', ['exception' => $e, 'item' => isset($item) ? $item : null]);
} finally {
Expand Down
48 changes: 24 additions & 24 deletions src/SprykerMiddleware/Zed/Process/ProcessDependencyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ public function provideBusinessLayerDependencies(Container $container): Containe
*/
protected function addConfigurationProfilesStack($container): Container
{
$container[static::MIDDLEWARE_CONFIGURATION_PROFILES] = function () {
$container->set(static::MIDDLEWARE_CONFIGURATION_PROFILES, function () {
return $this->getConfigurationProfilePluginsStack();
};
});

return $container;
}
Expand All @@ -133,9 +133,9 @@ protected function addConfigurationProfilesStack($container): Container
*/
protected function addConfigurationMappersStack($container): Container
{
$container[static::MIDDLEWARE_MAPPERS] = function () {
$container->set(static::MIDDLEWARE_MAPPERS, function () {
return $this->getConfigurationMappersPluginsStack();
};
});

return $container;
}
Expand All @@ -147,9 +147,9 @@ protected function addConfigurationMappersStack($container): Container
*/
protected function addProcessesStack($container): Container
{
$container[static::MIDDLEWARE_PROCESSES] = function () {
$container->set(static::MIDDLEWARE_PROCESSES, function () {
return $this->getProcessesPluginsStack();
};
});

return $container;
}
Expand Down Expand Up @@ -191,9 +191,9 @@ protected function getConfigurationMappersPluginsStack(): array
*/
protected function addEncodingService(Container $container): Container
{
$container[static::SERVICE_UTIL_ENCODING] = function (Container $container) {
$container->set(static::SERVICE_UTIL_ENCODING, function (Container $container) {
return new ProcessToUtilEncodingServiceBridge($container->getLocator()->utilEncoding()->service());
};
});

return $container;
}
Expand All @@ -205,9 +205,9 @@ protected function addEncodingService(Container $container): Container
*/
protected function addProcessService(Container $container): Container
{
$container[static::SERVICE_PROCESS] = function (Container $container) {
$container->set(static::SERVICE_PROCESS, function (Container $container) {
return $container->getLocator()->process()->service();
};
});

return $container;
}
Expand All @@ -219,9 +219,9 @@ protected function addProcessService(Container $container): Container
*/
protected function addLogHandlers($container): Container
{
$container[static::MIDDLEWARE_LOG_HANDLERS] = function () {
$container->set(static::MIDDLEWARE_LOG_HANDLERS, function () {
return $this->getLogHandlers();
};
});

return $container;
}
Expand All @@ -233,9 +233,9 @@ protected function addLogHandlers($container): Container
*/
protected function addLogProcessors($container): Container
{
$container[static::MIDDLEWARE_LOG_PROCESSORS] = function () {
$container->set(static::MIDDLEWARE_LOG_PROCESSORS, function () {
return $this->getLogProcessors();
};
});

return $container;
}
Expand All @@ -247,9 +247,9 @@ protected function addLogProcessors($container): Container
*/
protected function addMiddlewareLoggerConfigPlugin($container): Container
{
$container[static::MIDDLEWARE_LOG_CONFIG_PLUGIN] = function () {
$container->set(static::MIDDLEWARE_LOG_CONFIG_PLUGIN, function () {
return $this->getMiddlewareLoggerConfigPlugin();
};
});

return $container;
}
Expand All @@ -261,9 +261,9 @@ protected function addMiddlewareLoggerConfigPlugin($container): Container
*/
protected function addTranslatorFunctions($container): Container
{
$container[static::MIDDLEWARE_TRANSLATOR_FUNCTIONS] = function () {
$container->set(static::MIDDLEWARE_TRANSLATOR_FUNCTIONS, function () {
return $this->getTranslatorFunctionsStack();
};
});

return $container;
}
Expand All @@ -275,9 +275,9 @@ protected function addTranslatorFunctions($container): Container
*/
protected function addValidators($container): Container
{
$container[static::MIDDLEWARE_VALIDATORS] = function () {
$container->set(static::MIDDLEWARE_VALIDATORS, function () {
return $this->getValidatorsStack();
};
});

return $container;
}
Expand Down Expand Up @@ -368,9 +368,9 @@ protected function getValidatorsStack(): array
*/
protected function addDecoder($container)
{
$container[static::DECODER] = function () {
$container->set(static::DECODER, function () {
return $this->getDecoder();
};
});

return $container;
}
Expand All @@ -382,9 +382,9 @@ protected function addDecoder($container)
*/
protected function addEncoder($container)
{
$container[static::ENCODER] = function () {
$container->set(static::ENCODER, function () {
return $this->getEncoder();
};
});

return $container;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,21 @@ class MapperTest extends Unit
use MiddlewareLoggerTrait;

/**
* @var \SprykerMiddleware\Zed\Process\Business\ProcessFacade
* @var \SprykerMiddlewareTest\Zed\Process\ProcessZedTester
*/
protected $facade;

/**
* @var \SprykerMiddleware\Zed\Process\Business\ProcessFacade
*/
protected $dynamicFacade;
protected $tester;

/**
* @return void
*/
public function _before(): void
{
$this->dynamicFacade = $this->getDynamicFacade();
$this->facade = $this->getFacade();
$this->tester->mockFactoryMethod('createKeyMapper', $this->getKeyMapperMock());
$this->tester->mockFactoryMethod('createDynamicMapper', $this->getDynamicMapperMock());
$this->tester->mockFactoryMethod('createDynamicArrayMapper', $this->getDynamicArrayMapperMock());
$this->tester->mockFactoryMethod('createArrayMapper', $this->getArrayMapperMock());
$this->tester->mockFactoryMethod('createClosureMapper', $this->getClosureMapperMock());

parent::_before();
}

Expand Down Expand Up @@ -237,31 +236,31 @@ protected function getMapperPluginsStack(): array
->enableOriginalConstructor()
->setMethods(['getFacade'])
->getMock();
$dynamicArrayMapRulePluginMock->method('getFacade')->willReturn($this->facade);
$dynamicArrayMapRulePluginMock->method('getFacade')->willReturn($this->tester->getFacade());

$closureRuleMapPluginMock = $this->getMockBuilder(ClosureMapRulePlugin::class)
->enableOriginalConstructor()
->setMethods(['getFacade'])
->getMock();
$closureRuleMapPluginMock->method('getFacade')->willReturn($this->dynamicFacade);
$closureRuleMapPluginMock->method('getFacade')->willReturn($this->tester->getFacade());

$arrayMapRulePluginMock = $this->getMockBuilder(ArrayMapRulePlugin::class)
->enableOriginalConstructor()
->setMethods(['getFacade'])
->getMock();
$arrayMapRulePluginMock->method('getFacade')->willReturn($this->facade);
$arrayMapRulePluginMock->method('getFacade')->willReturn($this->tester->getFacade());

$dynamicMapRulePluginMock = $this->getMockBuilder(DynamicMapRulePlugin::class)
->enableOriginalConstructor()
->setMethods(['getFacade'])
->getMock();
$dynamicMapRulePluginMock->method('getFacade')->willReturn($this->dynamicFacade);
$dynamicMapRulePluginMock->method('getFacade')->willReturn($this->tester->getFacade());

$keyMapRulePluginMock = $this->getMockBuilder(KeyMapRulePlugin::class)
->enableOriginalConstructor()
->setMethods(['getFacade'])
->getMock();
$keyMapRulePluginMock->method('getFacade')->willReturn($this->dynamicFacade);
$keyMapRulePluginMock->method('getFacade')->willReturn($this->tester->getFacade());

return [
$dynamicArrayMapRulePluginMock,
Expand Down Expand Up @@ -344,48 +343,6 @@ protected function getOriginalPayload(): array
];
}

/**
* @return \SprykerMiddleware\Zed\Process\Business\ProcessFacade
*/
protected function getFacade()
{
$facade = new ProcessFacade();

$factory = $this->getMockBuilder(ProcessBusinessFactory::class)
->setMethods(['createKeyMapper', 'createDynamicArrayMapper', 'createArrayMapper', 'createDynamicMapper', 'createClosureMapper'])
->getMock();

$factory->method('createKeyMapper')->willReturn($this->getKeyMapperMock());
$factory->method('createDynamicMapper')->willReturn($this->getDynamicMapperMock());
$factory->method('createDynamicArrayMapper')->willReturn($this->getDynamicArrayMapperMock());
$factory->method('createArrayMapper')->willReturn($this->getArrayMapperMock());
$factory->method('createClosureMapper')->willReturn($this->getClosureMapperMock());

$facade->setFactory($factory);

return $facade;
}

/**
* @return \SprykerMiddleware\Zed\Process\Business\ProcessFacade
*/
protected function getDynamicFacade()
{
$facade = new ProcessFacade();

$factory = $this->getMockBuilder(ProcessBusinessFactory::class)
->setMethods(['createKeyMapper', 'createDynamicArrayMapper', 'createArrayMapper', 'createDynamicMapper', 'createClosureMapper'])
->getMock();

$factory->method('createKeyMapper')->willReturn($this->getKeyMapperMock());
$factory->method('createDynamicMapper')->willReturn($this->getDynamicMapperMock());
$factory->method('createClosureMapper')->willReturn($this->getClosureMapperMock());

$facade->setFactory($factory);

return $facade;
}

/**
* @return \SprykerMiddleware\Zed\Process\Business\Mapper\KeyMapper
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Generated\Shared\Transfer\IteratorConfigTransfer;
use Generated\Shared\Transfer\LoggerConfigTransfer;
use Generated\Shared\Transfer\ProcessSettingsTransfer;
use Monolog\Logger;
use Spryker\Zed\Kernel\Container;
use SprykerMiddleware\Zed\Process\Business\ProcessBusinessFactory;
use SprykerMiddleware\Zed\Process\Business\ProcessFacade;
Expand Down Expand Up @@ -55,6 +56,11 @@ class ProcessFacadeTest extends Unit
],
];

/**
* @var \SprykerMiddlewareTest\Zed\Process\ProcessZedTester
*/
protected $tester;

/**
* @return void
*/
Expand Down Expand Up @@ -86,7 +92,7 @@ protected function getProcessSettingsTransfer(): ProcessSettingsTransfer
$transfer->setInputPath(static::PATH_INPUT);
$transfer->setOutputPath(static::PATH_OUTPUT);
$transfer->setIteratorConfig(new IteratorConfigTransfer());
$transfer->setLoggerConfig(new LoggerConfigTransfer());
$transfer->setLoggerConfig((new LoggerConfigTransfer())->setVerboseLevel(Logger::DEBUG));

return $transfer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerMiddlewareTest\Zed\Process\Business\Mapper;
namespace SprykerMiddlewareTest\Zed\Process\Business\Translator;

use Codeception\Test\Unit;
use Generated\Shared\Transfer\TranslatorConfigTransfer;
Expand Down
3 changes: 2 additions & 1 deletion tests/SprykerMiddlewareTest/Zed/Process/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ suites:
modules:
enabled:
- Asserts
- \SprykerTest\Shared\Testify\Helper\Environment
- \SprykerTest\Shared\Testify\Helper\Environment
- \SprykerTest\Zed\Testify\Helper\BusinessHelper

0 comments on commit e7f1d7e

Please sign in to comment.