@@ -699,22 +699,24 @@ public function testExecuteWithNewCustomerAndValidationException()
699
699
'customer ' => [
700
700
'coolness ' => false ,
701
701
'disable_auto_group_change ' => 'false ' ,
702
+ 'dob ' => '3/12/1996 ' ,
702
703
],
703
704
'subscription ' => $ subscription ,
704
705
];
705
706
$ extractedData = [
706
707
'coolness ' => false ,
707
708
'disable_auto_group_change ' => 'false ' ,
709
+ 'dob ' => '1996-03-12 ' ,
708
710
];
709
711
710
712
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
711
713
$ attributeMock = $ this ->getMockBuilder (
712
714
\Magento \Customer \Api \Data \AttributeMetadataInterface::class
713
715
)->disableOriginalConstructor ()->getMock ();
714
- $ attributeMock ->expects ($ this ->once ( ))
716
+ $ attributeMock ->expects ($ this ->exactly ( 2 ))
715
717
->method ('getAttributeCode ' )
716
718
->willReturn ('coolness ' );
717
- $ attributeMock ->expects ($ this ->once ( ))
719
+ $ attributeMock ->expects ($ this ->exactly ( 2 ))
718
720
->method ('getFrontendInput ' )
719
721
->willReturn ('int ' );
720
722
$ attributes = [$ attributeMock ];
@@ -737,32 +739,32 @@ public function testExecuteWithNewCustomerAndValidationException()
737
739
$ objectMock = $ this ->getMockBuilder (\Magento \Framework \DataObject::class)
738
740
->disableOriginalConstructor ()
739
741
->getMock ();
740
- $ objectMock ->expects ($ this ->once ( ))
742
+ $ objectMock ->expects ($ this ->exactly ( 2 ))
741
743
->method ('getData ' )
742
744
->with ('customer ' )
743
745
->willReturn ($ postValue ['customer ' ]);
744
746
745
- $ this ->objectFactoryMock ->expects ($ this ->once ( ))
747
+ $ this ->objectFactoryMock ->expects ($ this ->exactly ( 2 ))
746
748
->method ('create ' )
747
749
->with (['data ' => $ postValue ])
748
750
->willReturn ($ objectMock );
749
751
750
752
$ customerFormMock = $ this ->getMockBuilder (
751
753
\Magento \Customer \Model \Metadata \Form::class
752
754
)->disableOriginalConstructor ()->getMock ();
753
- $ customerFormMock ->expects ($ this ->once ( ))
755
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
754
756
->method ('extractData ' )
755
757
->with ($ this ->requestMock , 'customer ' )
756
758
->willReturn ($ extractedData );
757
- $ customerFormMock ->expects ($ this ->once ( ))
759
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
758
760
->method ('compactData ' )
759
761
->with ($ extractedData )
760
762
->willReturn ($ extractedData );
761
- $ customerFormMock ->expects ($ this ->once ( ))
763
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
762
764
->method ('getAttributes ' )
763
765
->willReturn ($ attributes );
764
766
765
- $ this ->formFactoryMock ->expects ($ this ->once ( ))
767
+ $ this ->formFactoryMock ->expects ($ this ->exactly ( 2 ))
766
768
->method ('create ' )
767
769
->with (
768
770
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER ,
@@ -810,7 +812,10 @@ public function testExecuteWithNewCustomerAndValidationException()
810
812
811
813
$ this ->sessionMock ->expects ($ this ->once ())
812
814
->method ('setCustomerFormData ' )
813
- ->with ($ postValue );
815
+ ->with ([
816
+ 'customer ' => $ extractedData ,
817
+ 'subscription ' => $ subscription ,
818
+ ]);
814
819
815
820
/** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */
816
821
$ redirectMock = $ this ->getMockBuilder (\Magento \Framework \Controller \Result \Redirect::class)
@@ -841,22 +846,24 @@ public function testExecuteWithNewCustomerAndLocalizedException()
841
846
'customer ' => [
842
847
'coolness ' => false ,
843
848
'disable_auto_group_change ' => 'false ' ,
849
+ 'dob ' => '3/12/1996 ' ,
844
850
],
845
851
'subscription ' => $ subscription ,
846
852
];
847
853
$ extractedData = [
848
854
'coolness ' => false ,
849
855
'disable_auto_group_change ' => 'false ' ,
856
+ 'dob ' => '1996-03-12 ' ,
850
857
];
851
858
852
859
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
853
860
$ attributeMock = $ this ->getMockBuilder (
854
861
\Magento \Customer \Api \Data \AttributeMetadataInterface::class
855
862
)->disableOriginalConstructor ()->getMock ();
856
- $ attributeMock ->expects ($ this ->once ( ))
863
+ $ attributeMock ->expects ($ this ->exactly ( 2 ))
857
864
->method ('getAttributeCode ' )
858
865
->willReturn ('coolness ' );
859
- $ attributeMock ->expects ($ this ->once ( ))
866
+ $ attributeMock ->expects ($ this ->exactly ( 2 ))
860
867
->method ('getFrontendInput ' )
861
868
->willReturn ('int ' );
862
869
$ attributes = [$ attributeMock ];
@@ -879,12 +886,12 @@ public function testExecuteWithNewCustomerAndLocalizedException()
879
886
$ objectMock = $ this ->getMockBuilder (\Magento \Framework \DataObject::class)
880
887
->disableOriginalConstructor ()
881
888
->getMock ();
882
- $ objectMock ->expects ($ this ->once ( ))
889
+ $ objectMock ->expects ($ this ->exactly ( 2 ))
883
890
->method ('getData ' )
884
891
->with ('customer ' )
885
892
->willReturn ($ postValue ['customer ' ]);
886
893
887
- $ this ->objectFactoryMock ->expects ($ this ->once ( ))
894
+ $ this ->objectFactoryMock ->expects ($ this ->exactly ( 2 ))
888
895
->method ('create ' )
889
896
->with (['data ' => $ postValue ])
890
897
->willReturn ($ objectMock );
@@ -893,19 +900,19 @@ public function testExecuteWithNewCustomerAndLocalizedException()
893
900
$ customerFormMock = $ this ->getMockBuilder (
894
901
\Magento \Customer \Model \Metadata \Form::class
895
902
)->disableOriginalConstructor ()->getMock ();
896
- $ customerFormMock ->expects ($ this ->once ( ))
903
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
897
904
->method ('extractData ' )
898
905
->with ($ this ->requestMock , 'customer ' )
899
906
->willReturn ($ extractedData );
900
- $ customerFormMock ->expects ($ this ->once ( ))
907
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
901
908
->method ('compactData ' )
902
909
->with ($ extractedData )
903
910
->willReturn ($ extractedData );
904
- $ customerFormMock ->expects ($ this ->once ( ))
911
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
905
912
->method ('getAttributes ' )
906
913
->willReturn ($ attributes );
907
914
908
- $ this ->formFactoryMock ->expects ($ this ->once ( ))
915
+ $ this ->formFactoryMock ->expects ($ this ->exactly ( 2 ))
909
916
->method ('create ' )
910
917
->with (
911
918
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER ,
@@ -952,7 +959,10 @@ public function testExecuteWithNewCustomerAndLocalizedException()
952
959
953
960
$ this ->sessionMock ->expects ($ this ->once ())
954
961
->method ('setCustomerFormData ' )
955
- ->with ($ postValue );
962
+ ->with ([
963
+ 'customer ' => $ extractedData ,
964
+ 'subscription ' => $ subscription ,
965
+ ]);
956
966
957
967
/** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */
958
968
$ redirectMock = $ this ->getMockBuilder (\Magento \Framework \Controller \Result \Redirect::class)
@@ -983,22 +993,24 @@ public function testExecuteWithNewCustomerAndException()
983
993
'customer ' => [
984
994
'coolness ' => false ,
985
995
'disable_auto_group_change ' => 'false ' ,
996
+ 'dob ' => '3/12/1996 ' ,
986
997
],
987
998
'subscription ' => $ subscription ,
988
999
];
989
1000
$ extractedData = [
990
1001
'coolness ' => false ,
991
1002
'disable_auto_group_change ' => 'false ' ,
1003
+ 'dob ' => '1996-03-12 ' ,
992
1004
];
993
1005
994
1006
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
995
1007
$ attributeMock = $ this ->getMockBuilder (
996
1008
\Magento \Customer \Api \Data \AttributeMetadataInterface::class
997
1009
)->disableOriginalConstructor ()->getMock ();
998
- $ attributeMock ->expects ($ this ->once ( ))
1010
+ $ attributeMock ->expects ($ this ->exactly ( 2 ))
999
1011
->method ('getAttributeCode ' )
1000
1012
->willReturn ('coolness ' );
1001
- $ attributeMock ->expects ($ this ->once ( ))
1013
+ $ attributeMock ->expects ($ this ->exactly ( 2 ))
1002
1014
->method ('getFrontendInput ' )
1003
1015
->willReturn ('int ' );
1004
1016
$ attributes = [$ attributeMock ];
@@ -1021,32 +1033,32 @@ public function testExecuteWithNewCustomerAndException()
1021
1033
$ objectMock = $ this ->getMockBuilder (\Magento \Framework \DataObject::class)
1022
1034
->disableOriginalConstructor ()
1023
1035
->getMock ();
1024
- $ objectMock ->expects ($ this ->once ( ))
1036
+ $ objectMock ->expects ($ this ->exactly ( 2 ))
1025
1037
->method ('getData ' )
1026
1038
->with ('customer ' )
1027
1039
->willReturn ($ postValue ['customer ' ]);
1028
1040
1029
- $ this ->objectFactoryMock ->expects ($ this ->once ( ))
1041
+ $ this ->objectFactoryMock ->expects ($ this ->exactly ( 2 ))
1030
1042
->method ('create ' )
1031
1043
->with (['data ' => $ postValue ])
1032
1044
->willReturn ($ objectMock );
1033
1045
1034
1046
$ customerFormMock = $ this ->getMockBuilder (
1035
1047
\Magento \Customer \Model \Metadata \Form::class
1036
1048
)->disableOriginalConstructor ()->getMock ();
1037
- $ customerFormMock ->expects ($ this ->once ( ))
1049
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
1038
1050
->method ('extractData ' )
1039
1051
->with ($ this ->requestMock , 'customer ' )
1040
1052
->willReturn ($ extractedData );
1041
- $ customerFormMock ->expects ($ this ->once ( ))
1053
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
1042
1054
->method ('compactData ' )
1043
1055
->with ($ extractedData )
1044
1056
->willReturn ($ extractedData );
1045
- $ customerFormMock ->expects ($ this ->once ( ))
1057
+ $ customerFormMock ->expects ($ this ->exactly ( 2 ))
1046
1058
->method ('getAttributes ' )
1047
1059
->willReturn ($ attributes );
1048
1060
1049
- $ this ->formFactoryMock ->expects ($ this ->once ( ))
1061
+ $ this ->formFactoryMock ->expects ($ this ->exactly ( 2 ))
1050
1062
->method ('create ' )
1051
1063
->with (
1052
1064
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER ,
@@ -1095,7 +1107,10 @@ public function testExecuteWithNewCustomerAndException()
1095
1107
1096
1108
$ this ->sessionMock ->expects ($ this ->once ())
1097
1109
->method ('setCustomerFormData ' )
1098
- ->with ($ postValue );
1110
+ ->with ([
1111
+ 'customer ' => $ extractedData ,
1112
+ 'subscription ' => $ subscription ,
1113
+ ]);
1099
1114
1100
1115
/** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */
1101
1116
$ redirectMock = $ this ->getMockBuilder (\Magento \Framework \Controller \Result \Redirect::class)
0 commit comments