Skip to content

Commit dfa329f

Browse files
committed
Added test method testCreateCustomerSubscribed
1 parent 51b433c commit dfa329f

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,39 @@ public function testCreateCustomerIfPassedAttributeDosNotExistsInCustomerInput()
241241
$this->graphQlMutation($query);
242242
}
243243

244+
/**
245+
* @magentoApiDataFixture Magento/Customer/_files/customer_subscribe.php
246+
* @throws \Exception
247+
*/
248+
public function testCreateCustomerSubscribed()
249+
{
250+
$newFirstname = 'Richard';
251+
$newLastname = 'Rowe';
252+
$newEmail = '[email protected]';
253+
254+
$query = <<<QUERY
255+
mutation {
256+
createCustomer(
257+
input: {
258+
firstname: "{$newFirstname}"
259+
lastname: "{$newLastname}"
260+
email: "{$newEmail}"
261+
is_subscribed: true
262+
}
263+
) {
264+
customer {
265+
email
266+
is_subscribed
267+
}
268+
}
269+
}
270+
QUERY;
271+
272+
$response = $this->graphQlMutation($query);
273+
274+
$this->assertEquals(false, $response['createCustomer']['customer']['is_subscribed']);
275+
}
276+
244277
public function tearDown()
245278
{
246279
$newEmail = '[email protected]';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
use Magento\Customer\Model\CustomerRegistry;
7+
8+
$resourceConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
9+
->create(\Magento\Config\Model\ResourceModel\Config::class);
10+
11+
$resourceConfig->saveConfig(
12+
'newsletter/general/active',
13+
false,
14+
'default',
15+
0
16+
);

0 commit comments

Comments
 (0)