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
Merged

Adding a coupon generator command #10355

merged 8 commits into from May 30, 2019

Conversation

mamazu
Copy link
Member

@mamazu mamazu 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 a team as a code owner May 3, 2019 14:07
@Zales0123 Zales0123 added the Feature New feature proposals. label May 6, 2019
@mamazu
Copy link
Member Author

mamazu 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
Copy link
Member

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

@mamazu
Copy link
Member Author

mamazu commented May 15, 2019

I will try to get to it this evening.

@mamazu
Copy link
Member Author

mamazu commented May 15, 2019

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

@Zales0123
Copy link
Member

https://symfony.com/doc/current/console.html#testing-commands this can be useful, for the start

@mamazu
Copy link
Member Author

mamazu commented May 20, 2019

Done. :D

Copy link
Member

@lchrusciel lchrusciel left a comment

Choose a reason for hiding this comment

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

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
Copy link
Member Author

mamazu commented May 21, 2019

Yeah, right forgot that. 👍

@mamazu
Copy link
Member Author

mamazu 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
Copy link
Member

Choose a reason for hiding this comment

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

Could be finalized

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

Thanks, @mamazu! 🥇

@mamazu mamazu deleted the coupon_generator branch May 30, 2019 14:09
@ggabrovski
Copy link

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;

@alexsegura
Copy link

Yes, there is a problem, see #10692

@mamazu
Copy link
Member Author

mamazu commented Sep 23, 2019

True I didn't thought of that and this should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants