15 use \PHPUnit_Framework_MockObject_MockObject as MockObject;
22 private $accessChangeQuoteControl;
27 private $userContextMock;
37 private $quoteRepositoryMock;
42 private $changeQuoteControlMock;
46 $this->userContextMock = $this->getMockBuilder(UserContextInterface::class)
47 ->getMockForAbstractClass();
48 $this->userContextMock->method(
'getUserId')
51 $this->quoteMock = $this->getMockBuilder(Quote::class)
52 ->disableOriginalConstructor()
53 ->setMethods([
'getCustomerId'])
56 $this->quoteRepositoryMock = $this->getMockBuilder(QuoteRepository::class)
57 ->disableOriginalConstructor()
60 $this->changeQuoteControlMock = $this->getMockBuilder(ChangeQuoteControl::class)
61 ->disableOriginalConstructor()
65 $this->accessChangeQuoteControl = $objectManagerHelper->getObject(
66 AccessChangeQuoteControl::class,
67 [
'changeQuoteControl' => $this->changeQuoteControlMock]
76 $this->quoteMock->method(
'getCustomerId')
79 $this->userContextMock->method(
'getUserType')
82 $this->changeQuoteControlMock->method(
'isAllowed')
85 $result = $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
98 $this->quoteMock->method(
'getCustomerId')
101 $this->userContextMock->method(
'getUserType')
104 $this->changeQuoteControlMock->method(
'isAllowed')
107 $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
115 $this->quoteMock->method(
'getCustomerId')
118 $this->userContextMock->method(
'getUserType')
121 $this->changeQuoteControlMock->method(
'isAllowed')
124 $result = $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
134 $this->quoteMock->method(
'getCustomerId')
137 $this->userContextMock->method(
'getUserType')
140 $this->changeQuoteControlMock->method(
'isAllowed')
143 $result = $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
156 $this->quoteMock->method(
'getCustomerId')
159 $this->userContextMock->method(
'getUserType')
162 $this->changeQuoteControlMock->method(
'isAllowed')
165 $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
176 $this->quoteMock->method(
'getCustomerId')
179 $this->userContextMock->method(
'getUserType')
182 $this->changeQuoteControlMock->method(
'isAllowed')
185 $this->accessChangeQuoteControl->beforeSave($this->quoteRepositoryMock, $this->quoteMock);
testBeforeSaveForUnknownUserTypeException()
testBeforeSaveException()
testBeforeSaveForGuestException()
testBeforeSaveForCustomer()