/** * @return void */ public function testExecute() { $customerId = 1; $observerMock = $this->getMock('Magento\\Framework\\Event\\Observer', [], [], '', false); $eventMock = $this->getMock('Magento\\Framework\\Event', ['getData'], [], '', false); $observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock); $eventMock->expects($this->once())->method('getData')->with('model')->willReturn($this->customerModelMock); $this->customerModelMock->expects($this->once())->method('getId')->willReturn($customerId); $this->authenticationMock->expects($this->once())->method('unlock')->with($customerId); $this->customerLoginSuccessObserver->execute($observerMock); }
/** * @return void */ public function testExecute() { $customerId = 1; $observerMock = $this->getMock('Magento\\Framework\\Event\\Observer', [], [], '', false); $eventMock = $this->getMock('Magento\\Framework\\Event', ['getData'], [], '', false); $observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock); $eventMock->expects($this->once())->method('getData')->with('model')->willReturn($this->customerModelMock); $this->customerModelMock->expects($this->once())->method('getId')->willReturn($customerId); $this->customerRepositoryMock->expects($this->once())->method('getById')->willReturn($this->customerDataMock); $this->customerDataMock->expects($this->once())->method('getId')->willReturn($customerId); $this->accountManagementHelperMock->expects($this->once())->method('processUnlockData')->with($customerId); $this->customerRepositoryMock->expects($this->once())->method('save')->with($this->customerDataMock); $this->customerLoginSuccessObserver->execute($observerMock); }