Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[InstallerBundle] Simplification and testing of sylius:install:setup command #3814

Merged

Conversation

CoderMaggie
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Fixed tickets
License MIT

Removed multiple currencies, languages, countries and channels configuration.

Now when the currency is chosen it is set as base.

Added Behat testing of the command.

@CoderMaggie CoderMaggie force-pushed the sylius-install-setup-command branch 3 times, most recently from d934a69 to 5f70ec2 Compare January 5, 2016 09:22
@pjedrzejewski pjedrzejewski added the Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). label Jan 5, 2016
@@ -0,0 +1,21 @@
@installer
Feature: Sylius Install Feature
In order to install Sylius
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

via CLI

@CoderMaggie CoderMaggie force-pushed the sylius-install-setup-command branch 2 times, most recently from e8f3725 to 80025b9 Compare January 5, 2016 14:59
public function __construct()
{
parent::__construct();
$this->application = new Application($this->getKernel());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->getKernel() returns null, anybody can suggest me, why? Any solutions? :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you've encountered an error! :)

Contexts are instantiated in ContextFactory, exactly at line 80. They are initialized just one line below and KernelInterface instance is set by Symfony2Extension context initializer.

To solve this you can register @BeforeScenario hook (which has some downsides, especially that it would be called before every scenario in every suite that has CliContext). One another solution is to create application and register that command on I run a command "sylius:install:setup" step, which is cleaner and makes executing commands more isolated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pamil !

@michalmarcinkowski michalmarcinkowski changed the title [InstallerBundle] [WIP] Simplification and testing of sylius:install:setup command [WIP][InstallerBundle] Simplification and testing of sylius:install:setup command Jan 7, 2016
@@ -118,6 +118,19 @@ default:
filters:
tags: "@homepage"

installer:
contexts:
- Behat\MinkExtension\Context\MinkContext
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need MinkContext in CLI?

@CoderMaggie CoderMaggie force-pushed the sylius-install-setup-command branch 2 times, most recently from 0b73745 to cfc27f7 Compare January 8, 2016 15:54
@@ -118,6 +118,19 @@ default:
filters:
tags: "@homepage"

installer:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd call the suite cli.

@CoderMaggie CoderMaggie changed the title [WIP][InstallerBundle] Simplification and testing of sylius:install:setup command [InstallerBundle] Simplification and testing of sylius:install:setup command Jan 12, 2016
@CoderMaggie CoderMaggie force-pushed the sylius-install-setup-command branch 2 times, most recently from 635a8b2 to 688cc7a Compare January 15, 2016 07:31
@@ -3,4 +3,4 @@

imports:
- etc/behat/profiles.yml
- etc/behat/suites.yml
- etc/behat/suites.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be reverted

$channel->setCode($code);
$channel->setName($code);
$channel->setCode('DEFAULT');
$channel->setName('DEFAULT');
$channel->setColor(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it required?

@CoderMaggie CoderMaggie force-pushed the sylius-install-setup-command branch 4 times, most recently from 29fdd5a to 194a7f2 Compare February 25, 2016 14:36
@CoderMaggie
Copy link
Member Author

@michalmarcinkowski updated.

$countryManager->persist($country);
}
$currency->setExchangeRate(1);
$currency->setBase(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this command twice with different currencies I will have two base currencies in the database... We should validate that (in a separate PR).

$code = trim($code);
$name = Intl::getRegionBundle()->getCountryName($code);
$code = trim($code);
$name = Intl::getCurrencyBundle()->getCurrencyName($code);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extract this line to service and inject it here?

pjedrzejewski pushed a commit that referenced this pull request Mar 8, 2016
[InstallerBundle] Simplification and testing of sylius:install:setup command
@pjedrzejewski pjedrzejewski merged commit f08576f into Sylius:master Mar 8, 2016
@pjedrzejewski
Copy link
Member

Nice work Magda, thank you! 👍

@CoderMaggie CoderMaggie deleted the sylius-install-setup-command branch March 14, 2017 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants