5
5
*/
6
6
declare (strict_types=1 );
7
7
8
+ namespace Magento \QuoteGraphQl \Model \Resolver ;
9
+
8
10
use Magento \Catalog \Test \Fixture \Product as ProductFixture ;
9
11
use Magento \Customer \Test \Fixture \Customer ;
10
12
use Magento \Indexer \Test \Fixture \Indexer ;
15
17
use Magento \TestFramework \Fixture \DataFixture ;
16
18
use Magento \TestFramework \Fixture \DataFixtureStorageManager ;
17
19
use Magento \TestFramework \Helper \Bootstrap ;
18
- use Magento \TestFramework \Helper \CacheCleaner ;
19
20
use Magento \TestFramework \TestCase \GraphQl \ResponseContainsErrorsException ;
20
21
use Magento \TestFramework \TestCase \GraphQlAbstract ;
22
+ use Magento \Translation \Test \Fixture \Translation ;
21
23
22
24
class PlaceOrderTest extends GraphQlAbstract
23
25
{
@@ -41,10 +43,26 @@ protected function setUp(): void
41
43
* Test translated error message in non default store
42
44
*
43
45
* @magentoApiDataFixture Magento/Store/_files/second_store.php
44
- * @magentoApiDataFixture Magento/Translation/_files/place_order_message_translate.php
45
46
* @magentoConfigFixture fixture_second_store_store general/locale/code nl_NL
46
47
*/
47
48
#[
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
+ ),
48
66
DataFixture(ProductFixture::class, as: 'product ' ),
49
67
DataFixture(Indexer::class, as: 'indexer ' ),
50
68
DataFixture(Customer::class, ['email ' => 'customer@example.com ' ], as: 'customer ' ),
@@ -61,7 +79,6 @@ protected function setUp(): void
61
79
]
62
80
public function testPlaceOrderErrorTranslation ()
63
81
{
64
- CacheCleaner::clean (['translate ' , 'config ' ]);
65
82
$ storeCode = "fixture_second_store " ;
66
83
$ maskedQuoteId = DataFixtureStorageManager::getStorage ()->get ('quoteIdMask ' )->getMaskedId ();
67
84
$ query = $ this ->placeOrderQuery ($ maskedQuoteId );
@@ -71,9 +88,9 @@ public function testPlaceOrderErrorTranslation()
71
88
} catch (ResponseContainsErrorsException $ exception ) {
72
89
$ exceptionData = $ exception ->getResponseData ();
73
90
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 ' ,
77
94
$ exceptionData ['errors ' ][0 ]['message ' ]
78
95
);
79
96
}
0 commit comments