55 */
66declare (strict_types=1 );
77
8+ namespace Magento \QuoteGraphQl \Model \Resolver ;
9+
810use Magento \Catalog \Test \Fixture \Product as ProductFixture ;
911use Magento \Customer \Test \Fixture \Customer ;
1012use Magento \Indexer \Test \Fixture \Indexer ;
1517use Magento \TestFramework \Fixture \DataFixture ;
1618use Magento \TestFramework \Fixture \DataFixtureStorageManager ;
1719use Magento \TestFramework \Helper \Bootstrap ;
18- use Magento \TestFramework \Helper \CacheCleaner ;
1920use Magento \TestFramework \TestCase \GraphQl \ResponseContainsErrorsException ;
2021use Magento \TestFramework \TestCase \GraphQlAbstract ;
22+ use Magento \Translation \Test \Fixture \Translation ;
2123
2224class PlaceOrderTest extends GraphQlAbstract
2325{
@@ -41,10 +43,26 @@ protected function setUp(): void
4143 * Test translated error message in non default store
4244 *
4345 * @magentoApiDataFixture Magento/Store/_files/second_store.php
44- * @magentoApiDataFixture Magento/Translation/_files/place_order_message_translate.php
4546 * @magentoConfigFixture fixture_second_store_store general/locale/code nl_NL
4647 */
4748 #[
49+ DataFixture(
50+ Translation::class,
51+ [
52+ 'string ' => 'Unable to place order: %message ' ,
53+ 'translate ' => 'Kan geen bestelling plaatsen: %message ' ,
54+ 'locale ' => 'nl_NL ' ,
55+ ]
56+ ),
57+ DataFixture(
58+ Translation::class,
59+ [
60+ 'string ' => 'Some addresses can \'t be used due to the configurations for specific countries. ' ,
61+ 'translate ' => 'Sommige adressen kunnen niet worden ' .
62+ 'gebruikt vanwege de configuraties van specifieke landen. ' ,
63+ 'locale ' => 'nl_NL ' ,
64+ ]
65+ ),
4866 DataFixture(ProductFixture::class, as: 'product ' ),
4967 DataFixture(Indexer::class, as: 'indexer ' ),
5068 DataFixture(Customer::class, ['email ' => 'customer@example.com ' ], as: 'customer ' ),
@@ -61,7 +79,6 @@ protected function setUp(): void
6179 ]
6280 public function testPlaceOrderErrorTranslation ()
6381 {
64- CacheCleaner::clean (['translate ' , 'config ' ]);
6582 $ storeCode = "fixture_second_store " ;
6683 $ maskedQuoteId = DataFixtureStorageManager::getStorage ()->get ('quoteIdMask ' )->getMaskedId ();
6784 $ query = $ this ->placeOrderQuery ($ maskedQuoteId );
@@ -71,9 +88,9 @@ public function testPlaceOrderErrorTranslation()
7188 } catch (ResponseContainsErrorsException $ exception ) {
7289 $ exceptionData = $ exception ->getResponseData ();
7390 self ::assertEquals (1 , count ($ exceptionData ['errors ' ]));
74- self ::assertEquals (
75- ' Kan geen bestelling plaatsen: Sommige adressen kunnen niet worden gebruikt ' .
76- ' vanwege de configuraties van specifieke landen. ' ,
91+ self ::assertStringContainsString ( ' Kan geen bestelling plaatsen: ' , $ exceptionData [ ' errors ' ][ 0 ][ ' message ' ]);
92+ self :: assertStringContainsString (
93+ 'Sommige adressen kunnen niet worden ' ,
7794 $ exceptionData ['errors ' ][0 ]['message ' ]
7895 );
7996 }
0 commit comments