/** * @SuppressWarnings(PHPMD) * * @dataProvider getDataProvider * * @param array $fields * @param \stdClass $checkingObject */ public function testProcess(array $fields, $checkingObject) { $customerReverseProcessor = new CustomerReverseProcessor(); $checkingObject->entity = $this->customer; $this->customer->expects($this->any())->method('getOriginId')->will($this->returnValue(true)); $this->customer->expects($this->any())->method('getEmail')->will($this->returnValue($fields['email'])); $this->contact->expects($this->any())->method('getPrimaryEmail')->will($this->returnValue($fields['emailContact'])); $this->customer->expects($this->any())->method('getFirstName')->will($this->returnValue($fields['firstName'])); $this->contact->expects($this->any())->method('getFirstName')->will($this->returnValue($fields['firstNameContact'])); $this->customer->expects($this->any())->method('getLastName')->will($this->returnValue($fields['lastName'])); $this->contact->expects($this->any())->method('getLastName')->will($this->returnValue($fields['lastNameContact'])); $this->customer->expects($this->any())->method('getNamePrefix')->will($this->returnValue($fields['prefix'])); $this->contact->expects($this->any())->method('getNamePrefix')->will($this->returnValue($fields['prefixContact'])); $this->customer->expects($this->any())->method('getNameSuffix')->will($this->returnValue($fields['suffix'])); $this->contact->expects($this->any())->method('getNameSuffix')->will($this->returnValue($fields['suffixContact'])); $this->customer->expects($this->any())->method('getBirthday')->will($this->returnValue($fields['dob'])); $this->contact->expects($this->any())->method('getBirthday')->will($this->returnValue($fields['dobContact'])); $this->customer->expects($this->any())->method('getGender')->will($this->returnValue($fields['gender'])); $this->contact->expects($this->any())->method('getGender')->will($this->returnValue($fields['genderContact'])); $this->customer->expects($this->any())->method('getMiddleName')->will($this->returnValue($fields['middleName'])); $this->contact->expects($this->any())->method('getMiddleName')->will($this->returnValue($fields['middleNameContact'])); $this->address->expects($this->any())->method('getCity')->will($this->returnValue($fields['cityAddress'])); $this->contactAddress->expects($this->any())->method('getCity')->will($this->returnValue($fields['cityContactAddress'])); $this->address->expects($this->any())->method('getOrganization')->will($this->returnValue($fields['organizationAddress'])); $this->contactAddress->expects($this->any())->method('getOrganization')->will($this->returnValue($fields['organizationContactAddress'])); $this->address->expects($this->any())->method('getCountry')->will($this->returnValue($fields['countryAddress'])); $this->contactAddress->expects($this->any())->method('getCountry')->will($this->returnValue($fields['countryContactAddress'])); $this->address->expects($this->any())->method('getFirstName')->will($this->returnValue($fields['firstNameAddress'])); $this->contactAddress->expects($this->any())->method('getFirstName')->will($this->returnValue($fields['firstNameContactAddress'])); $this->address->expects($this->any())->method('getLastName')->will($this->returnValue($fields['lastNameAddress'])); $this->contactAddress->expects($this->any())->method('getLastName')->will($this->returnValue($fields['lastNameContactAddress'])); $this->address->expects($this->any())->method('getMiddleName')->will($this->returnValue($fields['middleNameAddress'])); $this->contactAddress->expects($this->any())->method('getMiddleName')->will($this->returnValue($fields['middleNameContactAddress'])); $this->address->expects($this->any())->method('getPostalCode')->will($this->returnValue($fields['postalCodeAddress'])); $this->contactAddress->expects($this->any())->method('getPostalCode')->will($this->returnValue($fields['postalCodeContactAddress'])); $this->address->expects($this->any())->method('getNamePrefix')->will($this->returnValue($fields['prefixAddress'])); $this->contactAddress->expects($this->any())->method('getNamePrefix')->will($this->returnValue($fields['prefixContactAddress'])); $this->address->expects($this->any())->method('getRegion')->will($this->returnValue($fields['regionAddress'])); $this->contactAddress->expects($this->any())->method('getRegion')->will($this->returnValue($fields['regionContactAddress'])); $this->address->expects($this->any())->method('getRegionText')->will($this->returnValue($fields['regionTextAddress'])); $this->contactAddress->expects($this->any())->method('getRegionText')->will($this->returnValue($fields['regionTextContactAddress'])); $this->address->expects($this->any())->method('getStreet')->will($this->returnValue($fields['streetAddress'])); $this->contactAddress->expects($this->any())->method('getStreet')->will($this->returnValue($fields['streetContactAddress'])); $this->address->expects($this->any())->method('getNameSuffix')->will($this->returnValue($fields['nameSuffixAddress'])); $this->contactAddress->expects($this->any())->method('getNameSuffix')->will($this->returnValue($fields['nameSuffixContactAddress'])); $this->address->expects($this->any())->method('getPhone')->will($this->returnValue($fields['phone'])); $this->contactPhone->expects($this->any())->method('getPhone')->will($this->returnValue($fields['phone'])); $this->contact->expects($this->any())->method('getAddresses')->will($this->returnValue([$this->contactAddress])); if (!empty($checkingObject->object['addresses'])) { foreach ($checkingObject->object['addresses'] as &$address) { $address['entity'] = $this->address; if (!empty($address['status'])) { if ('update' === $address['status']) { $address['object']['country'] = $this->country; $address['object']['region'] = $this->region; } } } unset($address); } $result = $customerReverseProcessor->process($this->customer); $this->assertEquals($checkingObject, $result); }