public function testSendNewAccountEmailWithoutStoreId() { $store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false); $website = $this->getMock('Magento\\Store\\Model\\Website', [], [], '', false); $website->expects($this->once())->method('getStoreIds')->will($this->returnValue([1, 2, 3, 4])); $this->_storeManager->expects($this->once())->method('getWebsite')->with(1)->will($this->returnValue($website)); $this->_storeManager->expects($this->once())->method('getStore')->with(1)->will($this->returnValue($store)); $this->_config->expects($this->exactly(3))->method('getAttribute')->will($this->returnValue($this->_attribute)); $this->_attribute->expects($this->exactly(3))->method('getIsVisible')->will($this->returnValue(true)); $methods = ['setTemplateIdentifier', 'setTemplateOptions', 'setTemplateVars', 'setFrom', 'addTo']; foreach ($methods as $method) { $this->_transportBuilderMock->expects($this->once())->method($method)->will($this->returnSelf()); } $transportMock = $this->getMock('Magento\\Framework\\Mail\\TransportInterface', [], [], '', false); $transportMock->expects($this->once())->method('sendMessage')->will($this->returnSelf()); $this->_transportBuilderMock->expects($this->once())->method('getTransport')->will($this->returnValue($transportMock)); $this->_model->setData(['website_id' => 1, 'store_id' => 1, 'email' => '*****@*****.**', 'firstname' => 'FirstName', 'lastname' => 'LastName', 'middlename' => 'MiddleName', 'prefix' => 'Prefix']); $this->_model->sendNewAccountEmail('registered'); }