coopTilleuls / CoopTilleulsSyliusClickNCollectPlugin

Sell and deliver securely during the COVID-19 pandemic!
https://click-n-collect.shop
GNU Affero General Public License v3.0
78 stars 34 forks source link

Do not validate if the shipping method is not click and collect #35

Closed jacquesbh closed 3 years ago

jacquesbh commented 4 years ago

The validation is always happening, even if the shipping method is not Click and Collect.

Fixing this behavior.

jacquesbh commented 4 years ago

The tests are failing because of the test suite, not because of the code changes 👋 .

toofff commented 4 years ago

@jacquesbh thank you for contribution. I just fixed the CI, could you do a rebase so I can merge your code, please

toofff commented 4 years ago

@jacquesbh could you rebase and fix the latest PHPunit tests, please

jacquesbh commented 4 years ago

I would love to fix the test, but I can't right now, too busy :(.

I hope I'll have time later in the following weeks.

toofff commented 4 years ago

Can I do it for you?

jacquesbh commented 4 years ago

Of course! I don't mind :).

thcolin commented 3 years ago

Hello !

Could you allow edits from maintainers on your pull request please ? Here is some documentation

If you prefer, here is a patch fixing tests :

--- a/src/Validator/Constraints/SlotAvailableValidator.php
+++ b/src/Validator/Constraints/SlotAvailableValidator.php
@@ -51,7 +51,7 @@ final class SlotAvailableValidator extends ConstraintValidator
             throw new UnexpectedValueException($value, ClickNCollectShipmentInterface::class);
         }

-        if (!$value->getMethod()->isClickNCollect()) {
+        if ((null === $method = $value->getMethod()) || !$method->isClickNCollect()) {
             return;
         }

Thanks !

thcolin commented 3 years ago

Hi ! Could you rebase your PR so we can merge and tag a new version please ? Thanks !