diff --git a/spec/Validator/Product/ConfigurableProductValidatorSpec.php b/spec/Validator/Product/ConfigurableProductValidatorSpec.php index 777518c84..b067d6c9b 100644 --- a/spec/Validator/Product/ConfigurableProductValidatorSpec.php +++ b/spec/Validator/Product/ConfigurableProductValidatorSpec.php @@ -59,7 +59,7 @@ function it_adds_a_violation_if_the_product_exists_and_is_not_configurable( $product->isConfigurable()->willReturn(false); - $executionContext->addViolation('sylius.shop_api.product.configurable')->shouldBeCalled(); + $executionContext->addViolation('sylius.shop_api.product.not_configurable')->shouldBeCalled(); $this->validate('PRODUCT_CODE', new ConfigurableProduct()); } diff --git a/spec/Validator/Product/ProductExistsValidatorSpec.php b/spec/Validator/Product/ProductExistsValidatorSpec.php index c9e589f81..409d16aa3 100644 --- a/spec/Validator/Product/ProductExistsValidatorSpec.php +++ b/spec/Validator/Product/ProductExistsValidatorSpec.php @@ -45,7 +45,7 @@ function it_adds_constraint_if_product_does_not_exists( ): void { $productRepository->findOneByCode('BARBECUE_CODE')->willReturn(null); - $executionContext->addViolation('sylius.shop_api.product.exists')->shouldBeCalled(); + $executionContext->addViolation('sylius.shop_api.product.not_exists')->shouldBeCalled(); $this->validate('BARBECUE_CODE', new ProductExists()); } diff --git a/spec/Validator/Product/SimpleProductValidatorSpec.php b/spec/Validator/Product/SimpleProductValidatorSpec.php index 5797bad67..036d3cadc 100644 --- a/spec/Validator/Product/SimpleProductValidatorSpec.php +++ b/spec/Validator/Product/SimpleProductValidatorSpec.php @@ -58,7 +58,7 @@ function it_adds_constraint_if_is_not_simple( $productRepository->findOneByCode('BARBECUE_CODE')->willReturn($product); $product->isSimple()->willReturn(false); - $executionContext->addViolation('sylius.shop_api.product.simple')->shouldBeCalled(); + $executionContext->addViolation('sylius.shop_api.product.not_simple')->shouldBeCalled(); $this->validate('BARBECUE_CODE', new SimpleProduct()); } diff --git a/src/Resources/translations/validators.en.yml b/src/Resources/translations/validators.en.yml index e2bb688bb..bddc33a1a 100644 --- a/src/Resources/translations/validators.en.yml +++ b/src/Resources/translations/validators.en.yml @@ -1,11 +1,18 @@ sylius: shop_api: + channel: + not_exists: Channel does not exist. cart: - not_exists: Cart does not exists. + not_exists: Cart does not exist. + cart_item: + not_exists: Cart item does not exist. + token: + already_taken: There is already a cart with this token. email: not_blank: Please enter your email. invalid: This email is invalid. unique: This email is already used. + not_found: There is no user with this email address password: not_blank: Please enter your password. first_name: @@ -13,8 +20,14 @@ sylius: last_name: not_blank: Please enter your last name. address_id: - not_null: Please provide address id + not_null: Please provide address id. address: - not_exists: Address doesn't exist + not_exists: Address does not exist. country: - not_exists: The country does not exist + not_exists: The country does not exist. + product: + not_configurable: The product is not configurable. + not_found: The product does not exists. + not_simple: The product is not a simple product + product_variant: + not_exists: The product variant does not exist. diff --git a/src/Validator/Constraints/ConfigurableProduct.php b/src/Validator/Constraints/ConfigurableProduct.php index 8c102d461..806e65a20 100644 --- a/src/Validator/Constraints/ConfigurableProduct.php +++ b/src/Validator/Constraints/ConfigurableProduct.php @@ -9,7 +9,7 @@ final class ConfigurableProduct extends Constraint { /** @var string */ - public $message = 'sylius.shop_api.product.configurable'; + public $message = 'sylius.shop_api.product.not_configurable'; /** {@inheritdoc} */ public function getTargets() diff --git a/src/Validator/Constraints/ProductExists.php b/src/Validator/Constraints/ProductExists.php index 2e91230f4..af7ab2003 100644 --- a/src/Validator/Constraints/ProductExists.php +++ b/src/Validator/Constraints/ProductExists.php @@ -9,7 +9,7 @@ final class ProductExists extends Constraint { /** @var string */ - public $message = 'sylius.shop_api.product.exists'; + public $message = 'sylius.shop_api.product.not_exists'; /** {@inheritdoc} */ public function getTargets() diff --git a/src/Validator/Constraints/SimpleProduct.php b/src/Validator/Constraints/SimpleProduct.php index 4dffabf89..3ffdd24dd 100644 --- a/src/Validator/Constraints/SimpleProduct.php +++ b/src/Validator/Constraints/SimpleProduct.php @@ -9,7 +9,7 @@ final class SimpleProduct extends Constraint { /** @var string */ - public $message = 'sylius.shop_api.product.simple'; + public $message = 'sylius.shop_api.product.not_simple'; /** {@inheritdoc} */ public function getTargets() diff --git a/tests/Responses/Expected/cart/cart_and_country_does_not_exist_response.json b/tests/Responses/Expected/cart/cart_and_country_does_not_exist_response.json index e3fc51064..b77a671bd 100644 --- a/tests/Responses/Expected/cart/cart_and_country_does_not_exist_response.json +++ b/tests/Responses/Expected/cart/cart_and_country_does_not_exist_response.json @@ -3,10 +3,10 @@ "message": "Validation failed", "errors": { "cartToken": [ - "Cart does not exists." + "Cart does not exist." ], "countryCode": [ - "The country does not exist" + "The country does not exist." ] } } diff --git a/tests/Responses/Expected/cart/cart_item_has_not_been_found_response.json b/tests/Responses/Expected/cart/cart_item_has_not_been_found_response.json index 2814e47c4..c73afc699 100644 --- a/tests/Responses/Expected/cart/cart_item_has_not_been_found_response.json +++ b/tests/Responses/Expected/cart/cart_item_has_not_been_found_response.json @@ -3,7 +3,7 @@ "message": "Validation failed", "errors": { "id": [ - "sylius.shop_api.cart_item.not_exists" + "Cart item does not exist." ] } } diff --git a/tests/Responses/Expected/cart/validation_cart_and_cart_item_not_exist_response.json b/tests/Responses/Expected/cart/validation_cart_and_cart_item_not_exist_response.json index 3189e864e..b139394ab 100644 --- a/tests/Responses/Expected/cart/validation_cart_and_cart_item_not_exist_response.json +++ b/tests/Responses/Expected/cart/validation_cart_and_cart_item_not_exist_response.json @@ -3,10 +3,10 @@ "message": "Validation failed", "errors": { "token": [ - "Cart does not exists." + "Cart does not exist." ], "id": [ - "sylius.shop_api.cart_item.not_exists" + "Cart item does not exist." ] } } diff --git a/tests/Responses/Expected/cart/validation_cart_item_not_exists_response.json b/tests/Responses/Expected/cart/validation_cart_item_not_exists_response.json index 2814e47c4..c73afc699 100644 --- a/tests/Responses/Expected/cart/validation_cart_item_not_exists_response.json +++ b/tests/Responses/Expected/cart/validation_cart_item_not_exists_response.json @@ -3,7 +3,7 @@ "message": "Validation failed", "errors": { "id": [ - "sylius.shop_api.cart_item.not_exists" + "Cart item does not exist." ] } } diff --git a/tests/Responses/Expected/cart/validation_cart_not_exists_response.json b/tests/Responses/Expected/cart/validation_cart_not_exists_response.json index b9958b3bd..b1d4d8d41 100644 --- a/tests/Responses/Expected/cart/validation_cart_not_exists_response.json +++ b/tests/Responses/Expected/cart/validation_cart_not_exists_response.json @@ -3,7 +3,7 @@ "message": "Validation failed", "errors": { "token": [ - "Cart does not exists." + "Cart does not exist." ] } } diff --git a/tests/Responses/Expected/cart/validation_product_not_configurable_response.json b/tests/Responses/Expected/cart/validation_product_not_configurable_response.json index c526bb6c1..0a5a743ce 100644 --- a/tests/Responses/Expected/cart/validation_product_not_configurable_response.json +++ b/tests/Responses/Expected/cart/validation_product_not_configurable_response.json @@ -3,7 +3,7 @@ "message": "Validation failed", "errors": { "productCode": [ - "sylius.shop_api.product.configurable" + "The product is not configurable." ] } } diff --git a/tests/Responses/Expected/cart/validation_product_not_defined_response.json b/tests/Responses/Expected/cart/validation_product_not_defined_response.json index 1928eb760..dc33cc2cb 100644 --- a/tests/Responses/Expected/cart/validation_product_not_defined_response.json +++ b/tests/Responses/Expected/cart/validation_product_not_defined_response.json @@ -4,7 +4,7 @@ "errors": { "productCode": [ "sylius.shop_api.product.not_null", - "sylius.shop_api.product.exists" + "sylius.shop_api.product.not_exists" ] } } diff --git a/tests/Responses/Expected/cart/validation_product_not_exists_response.json b/tests/Responses/Expected/cart/validation_product_not_exists_response.json index 19a7960ac..285353146 100644 --- a/tests/Responses/Expected/cart/validation_product_not_exists_response.json +++ b/tests/Responses/Expected/cart/validation_product_not_exists_response.json @@ -3,7 +3,7 @@ "message": "Validation failed", "errors": { "productCode": [ - "sylius.shop_api.product.exists" + "sylius.shop_api.product.not_exists" ] } } diff --git a/tests/Responses/Expected/cart/validation_product_not_simple_response.json b/tests/Responses/Expected/cart/validation_product_not_simple_response.json index 13a477fa2..b928cd5d2 100644 --- a/tests/Responses/Expected/cart/validation_product_not_simple_response.json +++ b/tests/Responses/Expected/cart/validation_product_not_simple_response.json @@ -3,7 +3,7 @@ "message": "Validation failed", "errors": { "productCode": [ - "sylius.shop_api.product.simple" + "The product is not a simple product" ] } } diff --git a/tests/Responses/Expected/customer/validation_email_not_defined_response.json b/tests/Responses/Expected/customer/validation_email_not_defined_response.json index ed9f80384..04226837f 100644 --- a/tests/Responses/Expected/customer/validation_email_not_defined_response.json +++ b/tests/Responses/Expected/customer/validation_email_not_defined_response.json @@ -4,7 +4,7 @@ "errors": { "email": [ "sylius.shop_api.email.not_null", - "sylius.shop_api.email.not_found" + "There is no user with this email address" ] } } diff --git a/tests/Responses/Expected/customer/validation_email_not_found_response.json b/tests/Responses/Expected/customer/validation_email_not_found_response.json index 0c568f052..bc3f8dd4f 100644 --- a/tests/Responses/Expected/customer/validation_email_not_found_response.json +++ b/tests/Responses/Expected/customer/validation_email_not_found_response.json @@ -3,7 +3,7 @@ "message": "Validation failed", "errors": { "email": [ - "sylius.shop_api.email.not_found" + "There is no user with this email address" ] } } diff --git a/tests/Responses/Expected/customer/validation_email_not_valid_response.json b/tests/Responses/Expected/customer/validation_email_not_valid_response.json index dd9075ce2..c4184b0dc 100644 --- a/tests/Responses/Expected/customer/validation_email_not_valid_response.json +++ b/tests/Responses/Expected/customer/validation_email_not_valid_response.json @@ -4,7 +4,7 @@ "errors": { "email": [ "sylius.shop_api.email.not_valid", - "sylius.shop_api.email.not_found" + "There is no user with this email address" ] } }