Config.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Mtf\Util\Command\Cli;
  7. use Magento\Mtf\Util\Command\Cli;
  8. /**
  9. * Handle set configuration for test execution.
  10. */
  11. class Config extends Cli
  12. {
  13. /**
  14. * Parameter for reindex command.
  15. */
  16. const PARAM_CONFIG_SET = 'config:set';
  17. /**
  18. * Set configuration.
  19. *
  20. * @param string $path
  21. * @param string $value
  22. * @param string|null $scope
  23. * @param string|null $scopeCode
  24. * @return void
  25. */
  26. public function setConfig($path, $value, $scope = null, $scopeCode = null)
  27. {
  28. $configurationString = '';
  29. if ($scope !== null) {
  30. $configurationString.= sprintf('--scope=%s ', $scope);
  31. }
  32. if ($scopeCode !== null) {
  33. $configurationString.= sprintf('--scope-code=%s ', $scopeCode);
  34. }
  35. $configurationString.= sprintf('%s %s', $path, $value);
  36. parent::execute(Config::PARAM_CONFIG_SET . ' ' . $configurationString);
  37. }
  38. }