/** * @test */ public function thatUpdate() { $branch = new Branch('DUMM', 'DUMMY_NAME', 'DUMMY_DESC'); $branchEmailConfiguration = new BranchEmailConfiguration($branch, self::DUMMY_CUSTOMER_DOMAINS, self::DUMMY_SUPPORT_ADDRESS); $branchEmailConfiguration->update('New Customer Domains', 'New Support Address'); $this->assertEquals('New Customer Domains', $branchEmailConfiguration->getCustomerDomains()); $this->assertEquals('New Support Address', $branchEmailConfiguration->getSupportAddress()); }
public static function fromBranchEmailConfiguration(BranchEmailConfiguration $branchEmailConfiguration) { $command = new self(); $command->id = $branchEmailConfiguration->getId(); $command->branch = $branchEmailConfiguration->getBranch(); $command->customerDomains = $branchEmailConfiguration->getCustomerDomains(); $command->supportAddress = $branchEmailConfiguration->getSupportAddress(); return $command; }
/** * @test */ public function updateBranchEmailConfigurationWhenExists() { $this->branchEmailConfigurationRepository->expects($this->exactly(2))->method('getByBranchId')->with($this->equalTo(self::DUMMY_BRANCH_ID))->will($this->returnValue($this->branchEmailConfiguration)); $this->branchEmailConfiguration->expects($this->once())->method('update')->with($this->equalTo(self::DUMMY_CUSTOMER_DOMAINS), $this->equalTo(self::DUMMY_SUPPORT_ADDRESS))->will($this->returnValue($this->branchEmailConfiguration)); $this->branchEmailConfigurationRepository->expects($this->once())->method('store'); $command = new BranchEmailConfigurationCommand(); $command->branch = self::DUMMY_BRANCH_ID; $command->customerDomains = self::DUMMY_CUSTOMER_DOMAINS; $command->supportAddress = self::DUMMY_SUPPORT_ADDRESS; $this->branchEmailConfigurationServiceImpl->updateBranchEmailConfiguration($command); }