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

Adding a coupon generator command #10355

Merged
merged 8 commits into from May 30, 2019

Conversation

@mamazu
Copy link
Contributor

commented May 3, 2019

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets none
License MIT

For people who like to generate coupon codes with the command line I have written a command to do so.

@mamazu mamazu requested a review from Sylius/core-team as a code owner May 3, 2019

mamazu added 2 commits May 3, 2019

@Zales0123 Zales0123 added the Feature label May 6, 2019

@mamazu

This comment has been minimized.

Copy link
Contributor Author

commented May 13, 2019

I am trying to write a behat test but I am not sure how to mock the dependencies properly. The other commands use the container aware command as their base class which is deprecated. Should the GenerateCouponCommand also use this and if not how do I instantiate it.

@lchrusciel

This comment has been minimized.

Copy link
Member

commented May 14, 2019

What about some functional test with PHPunit, where we will generate some commands and assert if they are available in the database?

@mamazu

This comment has been minimized.

Copy link
Contributor Author

commented May 15, 2019

I will try to get to it this evening.

@mamazu

This comment has been minimized.

Copy link
Contributor Author

commented May 15, 2019

Is there any kind of reference for a command that is tested with phpunit?

@Zales0123

This comment has been minimized.

Copy link
Member

commented May 15, 2019

mamazu added 2 commits May 16, 2019

@mamazu mamazu force-pushed the Brille24:coupon_generator branch 2 times, most recently from f70a3d5 to 068f487 May 17, 2019

@mamazu

This comment has been minimized.

Copy link
Contributor Author

commented May 20, 2019

Done. :D

@lchrusciel
Copy link
Member

left a comment

Minor cs problems, vendor/bin/ecs check --ansi --no-progress-bar path-toyour-classes --fix should fix it. Other than that, good to go.

@mamazu

This comment has been minimized.

Copy link
Contributor Author

commented May 21, 2019

Yeah, right forgot that. 👍

@mamazu

This comment has been minimized.

Copy link
Contributor Author

commented May 27, 2019

@Zales0123 What do you think?

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;
class GenerateCouponsCommandTest extends KernelTestCase

This comment has been minimized.

Copy link
@lchrusciel

lchrusciel May 30, 2019

Member

Could be finalized

@lchrusciel lchrusciel merged commit 1bfcb33 into Sylius:master May 30, 2019

2 checks passed

WIP Ready for review
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@lchrusciel

This comment has been minimized.

Copy link
Member

commented May 30, 2019

Thanks, @mamazu! 🥇

@mamazu mamazu deleted the Brille24:coupon_generator branch May 30, 2019

@ggabrovski

This comment has been minimized.

Copy link

commented Sep 10, 2019

You have related the command to the core component and this will make problem if the PromotionBundle is integrated into Symfony app, without the Sylius core component.

I suggest to change this:
use Sylius\Component\Core\Model\PromotionInterface;
use Sylius\Component\Core\Repository\PromotionRepositoryInterface;

to:
use Sylius\Component\Promotion\Model\PromotionInterface;
use Sylius\Component\Promotion\Repository\PromotionRepositoryInterface;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.