-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Exception are not translated to store scope #32953
Merged
magento-devops-reposync-svc
merged 21 commits into
magento:2.4-develop
from
rikwillems:31351-translations-graphql
Apr 12, 2022
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1b4a3bc
Exception are not translated to store scope
rikwillems f096a71
Update per Backward Compatibility Policy
rikwillems f05bec2
Fix double semicolon
rikwillems e7c2ee9
Fix typehint
rikwillems 6265480
Merge branch '2.4-develop' into 31351-translations-graphql
ab5d921
Added Valid store check to avoid Fatal errors
shikhamis11 dcfa3b9
Merge branch '2.4-develop' into 31351-translations-graphql
511ab01
Refactor testProductFromSpecificAndDefaultStore
shikhamis11 77e8af4
Merge branch '2.4-develop' into 31351-translations-graphql
cpartica 01a3904
Added Test for Translation
shikhamis11 cd123f5
Merge branch '2.4-develop' into 31351-translations-graphql
e565f3f
Fixed static test
shikhamis11 b51f420
Fixed static test
shikhamis11 379d2b0
Fixed static test
shikhamis11 ab8b8b4
Merge branch '2.4-develop' into 31351-translations-graphql
cpartica 0cef678
Fixed fatal error with non existing store
shikhamis11 f6329fe
Merge branch '2.4-develop' into 31351-translations-graphql
f3fc159
Fixed Static test
shikhamis11 2f656a6
Fixed Parameters order
shikhamis11 c7ed1e5
Updated constructor comment
shikhamis11 4635cf1
Merge branch '2.4-develop' into 31351-translations-graphql
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...i-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\GraphQl\Catalog; | ||
|
||
use Magento\TestFramework\TestCase\GraphQlAbstract; | ||
use Magento\TestFramework\Helper\CacheCleaner; | ||
|
||
/** | ||
* The GraphQl test for product in non default store with different locale | ||
*/ | ||
class ProductSearchWithTranslatedMessageTest extends GraphQlAbstract | ||
{ | ||
/** | ||
* Test translated error message in non default store | ||
* | ||
* @magentoApiDataFixture Magento/Store/_files/second_store.php | ||
* @magentoApiDataFixture Magento/Translation/_files/catalog_message_translate.php | ||
* @magentoConfigFixture fixture_second_store_store general/locale/code nl_NL | ||
*/ | ||
public function testErrorMessageTranslationInNonDefaultLocale() | ||
{ | ||
CacheCleaner::clean(['translate', 'config']); | ||
$storeCode = "fixture_second_store"; | ||
$header = ['Store' => $storeCode]; | ||
$this->expectException(\Exception::class); | ||
$this->expectExceptionMessage('currentPage-waarde moet groter zijn dan 0.'); | ||
$this->graphQlQuery($this->getQuery(), [], '', $header); | ||
} | ||
|
||
private function getQuery() | ||
{ | ||
return <<<QUERY | ||
{ | ||
products( currentPage: 0) { | ||
items { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
QUERY; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
dev/tests/integration/testsuite/Magento/Translation/_files/catalog_message_translate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
/** @var \Magento\Translation\Model\ResourceModel\StringUtils $translateString */ | ||
$translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Translation\Model\ResourceModel\StringUtils::class | ||
); | ||
$translateString->saveTranslate( | ||
'currentPage value must be greater than 0.', | ||
'currentPage-waarde moet groter zijn dan 0.', | ||
"nl_NL", | ||
0 | ||
); |
13 changes: 13 additions & 0 deletions
13
...s/integration/testsuite/Magento/Translation/_files/catalog_message_translate_rollback.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
/** @var \Magento\Translation\Model\ResourceModel\StringUtils $translateString */ | ||
$translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Translation\Model\ResourceModel\StringUtils::class | ||
); | ||
$translateString->deleteTranslate('currentPage value must be greater than 0.', "nl_NL", 0); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shikhamis11 can you add really quick the " | null" here to be consistent with the constructor?