This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Added createCustomerGraphQl plugin #763
Merged
magento-engcom-team
merged 25 commits into
magento:2.3-develop
from
sedonik:subscribe-for-newsletter
Sep 10, 2019
Merged
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b31f618
Added createCustomerGraphQl plugin
sedonik 51b433c
Moved logic from plugin to CreateCustomer
sedonik dfa329f
Added test method testCreateCustomerSubscribed
sedonik 2ca7872
Added rollback for newsletter/general/active
sedonik c37a7a4
Added todo
sedonik c09c17e
Created Config Module for Newsletter
sedonik c646296
Deleted redundant dependency + set scopeType
sedonik 02654a6
Added changes from PR #807
sedonik 245e0a0
Merge branch '2.3-develop' into subscribe-for-newsletter
sedonik 8b1e739
Corrected Code Style
sedonik 6a4ecbe
Added lines *Deleted unnecessary uses
sedonik b4bdc73
Removed customer_subscribe.php and customer_subscribe_rollback.php
sedonik 9cecea1
Update app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomer…
sedonik 68940ec
Renamed $config to $newsletterConfig
sedonik b88a3db
Renamed config to newsletterConfig
sedonik 010536d
Renamed config to newsletterConfig
sedonik bf5d622
Renamed config to newsletterConfig
sedonik 75e2408
Deleted empty line
sedonik c0caee9
Removed Exception
sedonik e99ddb8
Set magentoApiDataFixture
sedonik bfb57ec
Corrected newsLetterConfig
sedonik c35ac36
Corrected code styles
sedonik 1e0db4d
Used @magentoConfigFixture + deleted customer_subscribe.php, customer…
sedonik dcd7178
Merge remote-tracking branch 'upstream/2.3-develop' into subscribe-fo…
sedonik 0768d89
magento/graphql-ce#762: Subscribe for newsletter even when not allowed
lenaorobei 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,7 +251,6 @@ public function testCreateCustomerIfNameEmpty() | |
$newFirstname = ''; | ||
$newLastname = 'Rowe'; | ||
$currentPassword = 'test123#'; | ||
|
||
$query = <<<QUERY | ||
mutation { | ||
createCustomer( | ||
|
@@ -275,6 +274,38 @@ public function testCreateCustomerIfNameEmpty() | |
QUERY; | ||
$this->graphQlMutation($query); | ||
} | ||
|
||
/** | ||
* @magentoApiDataFixture Magento/Customer/_files/customer_subscribe.php | ||
*/ | ||
public function testCreateCustomerSubscribed() | ||
{ | ||
$newFirstname = 'Richard'; | ||
$newLastname = 'Rowe'; | ||
$newEmail = '[email protected]'; | ||
|
||
$query = <<<QUERY | ||
mutation { | ||
createCustomer( | ||
input: { | ||
firstname: "{$newFirstname}" | ||
lastname: "{$newLastname}" | ||
email: "{$newEmail}" | ||
is_subscribed: true | ||
} | ||
) { | ||
customer { | ||
is_subscribed | ||
} | ||
} | ||
} | ||
QUERY; | ||
|
||
$response = $this->graphQlMutation($query); | ||
|
||
$this->assertEquals(false, $response['createCustomer']['customer']['is_subscribed']); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
|
13 changes: 13 additions & 0 deletions
13
dev/tests/integration/testsuite/Magento/Customer/_files/customer_subscribe.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 | ||
lenaorobei marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be removed. |
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of this fixture please use |
||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
$resourceConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() | ||
->create(\Magento\Config\Model\ResourceModel\Config::class); | ||
$resourceConfig->saveConfig( | ||
'newsletter/general/active', | ||
false, | ||
'default', | ||
0 | ||
); |
16 changes: 16 additions & 0 deletions
16
dev/tests/integration/testsuite/Magento/Customer/_files/customer_subscribe_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,16 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be removed. |
||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
// TODO: Should be removed in scope of https://github.com/magento/graphql-ce/issues/167 | ||
|
||
declare(strict_types=1); | ||
|
||
use Magento\Framework\App\Config\Storage\WriterInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
$objectManager = Bootstrap::getObjectManager(); | ||
/** @var Writer $configWriter */ | ||
$configWriter = $objectManager->create(WriterInterface::class); | ||
$configWriter->delete('newsletter/general/active'); |
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.
@magentoConfigFixture default_store newsletter/general/active 0