protected function setUp() { $this->prepareContext(); $this->customerSession = $this->getMockBuilder('Magento\\Customer\\Model\\Session')->disableOriginalConstructor()->setMethods(['getCustomerId', 'setCustomerFormData', 'logout', 'start'])->getMock(); $this->customerAccountManagement = $this->getMockBuilder('Magento\\Customer\\Model\\AccountManagement')->disableOriginalConstructor()->setMethods(['changePassword'])->getMock(); $this->customerRepository = $this->getMockBuilder('Magento\\Customer\\Api\\CustomerRepositoryInterface')->getMockForAbstractClass(); $this->validator = $this->getMockBuilder('Magento\\Framework\\Data\\Form\\FormKey\\Validator')->disableOriginalConstructor()->getMock(); $this->customerExtractor = $this->getMockBuilder('Magento\\Customer\\Model\\CustomerExtractor')->disableOriginalConstructor()->getMock(); $this->accountManagementHelper = $this->getMockBuilder('Magento\\Customer\\Helper\\AccountManagement')->disableOriginalConstructor()->getMock(); $this->emailNotification = $this->getMockBuilder('Magento\\Customer\\Helper\\EmailNotification')->disableOriginalConstructor()->setMethods(['sendNotificationEmailsIfRequired'])->getMock(); $this->model = new EditPost($this->context, $this->customerSession, $this->customerAccountManagement, $this->customerRepository, $this->validator, $this->customerExtractor); $this->model->setEmailNotification($this->emailNotification); $this->model->setAccountManagementHelper($this->accountManagementHelper); }