Skip to content

Commit dceb003

Browse files
author
Mark Berube
committed
MC-40099: Changing groupId functionality on createAccount()
1 parent 44d89ee commit dceb003

File tree

1 file changed

+61
-60
lines changed

1 file changed

+61
-60
lines changed

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -696,42 +696,42 @@ public function testCreateAccountWithoutPassword()
696696
->disableOriginalConstructor()
697697
->getMock();
698698
$testCase = $this;
699-
$customer->expects( $this->any() )
700-
->method( 'getId' )
701-
->will( $this->returnCallback( function () use ( $testCase, $customerId) {
702-
if ($testCase->getIdCounter > 0 ) {
699+
$customer->expects($this->any())
700+
->method('getId')
701+
->will($this->returnCallback(function () use ($testCase, $customerId) {
702+
if ($testCase->getIdCounter > 0) {
703703
return $customerId;
704704
} else {
705705
$testCase->getIdCounter += 1;
706706
return null;
707707
}
708-
} ) );
708+
}));
709709
$customer->expects($this->atLeastOnce())
710710
->method('getEmail')
711711
->willReturn($customerEmail);
712-
$customer->expects( $this->any() )
713-
->method( 'getWebsiteId' )
714-
->will( $this->returnCallback( function () use ( $testCase, $websiteId) {
715-
if ($testCase->getWebsiteIdCounter > 1 ) {
712+
$customer->expects($this->any())
713+
->method('getWebsiteId')
714+
->will($this->returnCallback(function () use ($testCase, $websiteId) {
715+
if ($testCase->getWebsiteIdCounter > 1) {
716716
return $websiteId;
717717
} else {
718718
$testCase->getWebsiteIdCounter += 1;
719719
return null;
720720
}
721-
} ) );
721+
}));
722722
$customer->expects($this->once())
723723
->method('setWebsiteId')
724724
->with($websiteId);
725-
$customer->expects( $this->any() )
726-
->method( 'getStoreId' )
727-
->will( $this->returnCallback( function () use ( $testCase, $defaultStoreId) {
728-
if ($testCase->getStoreIdCounter > 0 ) {
725+
$customer->expects($this->any())
726+
->method('getStoreId')
727+
->will($this->returnCallback(function () use ($testCase, $defaultStoreId) {
728+
if ($testCase->getStoreIdCounter > 0) {
729729
return $defaultStoreId;
730730
} else {
731731
$testCase->getStoreIdCounter += 1;
732732
return null;
733733
}
734-
} ) );
734+
}));
735735
$customer->expects($this->once())
736736
->method('setStoreId')
737737
->with($defaultStoreId);
@@ -979,42 +979,42 @@ public function testCreateAccountWithPassword()
979979
->disableOriginalConstructor()
980980
->getMock();
981981
$testCase = $this;
982-
$customer->expects( $this->any() )
983-
->method( 'getId' )
984-
->will( $this->returnCallback( function () use ( $testCase, $customerId) {
985-
if ($testCase->getIdCounter > 0 ) {
982+
$customer->expects($this->any())
983+
->method('getId')
984+
->will($this->returnCallback(function () use ($testCase, $customerId) {
985+
if ($testCase->getIdCounter > 0) {
986986
return $customerId;
987987
} else {
988988
$testCase->getIdCounter += 1;
989989
return null;
990990
}
991-
} ) );
991+
}));
992992
$customer->expects($this->atLeastOnce())
993993
->method('getEmail')
994994
->willReturn($customerEmail);
995-
$customer->expects( $this->any() )
996-
->method( 'getWebsiteId' )
997-
->will( $this->returnCallback( function () use ( $testCase, $websiteId) {
998-
if ($testCase->getWebsiteIdCounter > 1 ) {
995+
$customer->expects($this->any())
996+
->method('getWebsiteId')
997+
->will($this->returnCallback(function () use ($testCase, $websiteId) {
998+
if ($testCase->getWebsiteIdCounter > 1) {
999999
return $websiteId;
10001000
} else {
10011001
$testCase->getWebsiteIdCounter += 1;
10021002
return null;
10031003
}
1004-
} ) );
1004+
}));
10051005
$customer->expects($this->once())
10061006
->method('setWebsiteId')
10071007
->with($websiteId);
1008-
$customer->expects( $this->any() )
1009-
->method( 'getStoreId' )
1010-
->will( $this->returnCallback( function () use ( $testCase, $defaultStoreId) {
1011-
if ($testCase->getStoreIdCounter > 0 ) {
1008+
$customer->expects($this->any())
1009+
->method('getStoreId')
1010+
->will($this->returnCallback(function () use ($testCase, $defaultStoreId) {
1011+
if ($testCase->getStoreIdCounter > 0) {
10121012
return $defaultStoreId;
10131013
} else {
10141014
$testCase->getStoreIdCounter += 1;
10151015
return null;
10161016
}
1017-
} ) );
1017+
}));
10181018
$customer->expects($this->once())
10191019
->method('setStoreId')
10201020
->with($defaultStoreId);
@@ -1161,16 +1161,16 @@ public function testCreateAccountWithGroupId()
11611161
->disableOriginalConstructor()
11621162
->getMock();
11631163
$testCase = $this;
1164-
$customer->expects( $this->any() )
1165-
->method( 'getId' )
1166-
->will( $this->returnCallback( function () use ( $testCase, $customerId) {
1167-
if ($testCase->getIdCounter > 0 ) {
1164+
$customer->expects($this->any())
1165+
->method('getId')
1166+
->will($this->returnCallback(function () use ($testCase, $customerId) {
1167+
if ($testCase->getIdCounter > 0) {
11681168
return $customerId;
11691169
} else {
11701170
$testCase->getIdCounter += 1;
11711171
return null;
11721172
}
1173-
} ) );
1173+
}));
11741174
$customer->expects($this->atLeastOnce())
11751175
->method('getGroupId')
11761176
->willReturn($requestedGroupId);
@@ -1183,29 +1183,29 @@ public function testCreateAccountWithGroupId()
11831183
$customer->expects($this->atLeastOnce())
11841184
->method('getEmail')
11851185
->willReturn($customerEmail);
1186-
$customer->expects( $this->any() )
1187-
->method( 'getWebsiteId' )
1188-
->will( $this->returnCallback( function () use ( $testCase, $websiteId) {
1189-
if ($testCase->getWebsiteIdCounter > 1 ) {
1186+
$customer->expects($this->any())
1187+
->method('getWebsiteId')
1188+
->will($this->returnCallback(function () use ($testCase, $websiteId) {
1189+
if ($testCase->getWebsiteIdCounter > 1) {
11901190
return $websiteId;
11911191
} else {
11921192
$testCase->getWebsiteIdCounter += 1;
11931193
return null;
11941194
}
1195-
} ) );
1195+
}));
11961196
$customer->expects($this->once())
11971197
->method('setWebsiteId')
11981198
->with($websiteId);
1199-
$customer->expects( $this->any() )
1200-
->method( 'getStoreId' )
1201-
->will( $this->returnCallback( function () use ( $testCase, $defaultStoreId) {
1202-
if ($testCase->getStoreIdCounter > 0 ) {
1199+
$customer->expects($this->any())
1200+
->method('getStoreId')
1201+
->will($this->returnCallback(function () use ($testCase, $defaultStoreId) {
1202+
if ($testCase->getStoreIdCounter > 0) {
12031203
return $defaultStoreId;
12041204
} else {
12051205
$testCase->getStoreIdCounter += 1;
12061206
return null;
12071207
}
1208-
} ) );
1208+
}));
12091209
$customer->expects($this->once())
12101210
->method('setStoreId')
12111211
->with($defaultStoreId);
@@ -2228,6 +2228,7 @@ private function prepareDateTimeFactory()
22282228
}
22292229

22302230
/**
2231+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
22312232
* @return void
22322233
* @throws LocalizedException
22332234
*/
@@ -2258,42 +2259,42 @@ public function testCreateAccountUnexpectedValueException(): void
22582259
->willReturn([1, 2, 3]);
22592260
$customer = $this->createMock(Customer::class);
22602261
$testCase = $this;
2261-
$customer->expects( $this->any() )
2262-
->method( 'getId' )
2263-
->will( $this->returnCallback( function () use ( $testCase, $customerId) {
2264-
if ($testCase->getIdCounter > 0 ) {
2262+
$customer->expects($this->any())
2263+
->method('getId')
2264+
->will($this->returnCallback(function () use ($testCase, $customerId) {
2265+
if ($testCase->getIdCounter > 0) {
22652266
return $customerId;
22662267
} else {
22672268
$testCase->getIdCounter += 1;
22682269
return null;
22692270
}
2270-
} ) );
2271+
}));
22712272
$customer->expects($this->atLeastOnce())
22722273
->method('getEmail')
22732274
->willReturn($customerEmail);
2274-
$customer->expects( $this->any() )
2275-
->method( 'getWebsiteId' )
2276-
->will( $this->returnCallback( function () use ( $testCase, $websiteId) {
2277-
if ($testCase->getWebsiteIdCounter > 1 ) {
2275+
$customer->expects($this->any())
2276+
->method('getWebsiteId')
2277+
->will($this->returnCallback(function () use ($testCase, $websiteId) {
2278+
if ($testCase->getWebsiteIdCounter > 1) {
22782279
return $websiteId;
22792280
} else {
22802281
$testCase->getWebsiteIdCounter += 1;
22812282
return null;
22822283
}
2283-
} ) );
2284+
}));
22842285
$customer->expects($this->once())
22852286
->method('setWebsiteId')
22862287
->with($websiteId);
2287-
$customer->expects( $this->any() )
2288-
->method( 'getStoreId' )
2289-
->will( $this->returnCallback( function () use ( $testCase, $defaultStoreId) {
2290-
if ($testCase->getStoreIdCounter > 0 ) {
2288+
$customer->expects($this->any())
2289+
->method('getStoreId')
2290+
->will($this->returnCallback(function () use ($testCase, $defaultStoreId) {
2291+
if ($testCase->getStoreIdCounter > 0) {
22912292
return $defaultStoreId;
22922293
} else {
22932294
$testCase->getStoreIdCounter += 1;
22942295
return null;
22952296
}
2296-
} ) );
2297+
}));
22972298
$customer->expects($this->once())
22982299
->method('setStoreId')
22992300
->with($defaultStoreId);

0 commit comments

Comments
 (0)