Skip to content

Commit

Permalink
makes address fields consistent. #406
Browse files Browse the repository at this point in the history
  • Loading branch information
cbleek committed Sep 29, 2017
1 parent fd95f70 commit f5bc459
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 9 deletions.
30 changes: 29 additions & 1 deletion module/Auth/src/Auth/Entity/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,14 @@ class Info extends AbstractEntity implements InfoInterface
* @var string
* @ODM\Field(type="string") */
protected $street;


/**
* country of the users address
*
* @var string
* @ODM\Field(type="string") */
protected $country;

/**
* {@inheritdoc}
*
Expand Down Expand Up @@ -432,4 +439,25 @@ public function getStreet()
{
return $this->street;
}

/**
* {@inheritdoc}
*
* @return $this
*/
public function setCountry($country)
{
$this->country=$country;
return $this;
}

/**
* {@inheritdoc}
*
* @return string
*/
public function getCountry()
{
return $this->country;
}
}
16 changes: 16 additions & 0 deletions module/Auth/src/Auth/Entity/InfoInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,20 @@ public function setCity($city);
* @return string
*/
public function getCity();

/**
* Sets the users country
*
* @param string $country
* @since 0.30
*/
public function setCountry($country);

/**
* Gets the users country
*
* @since 0.30
* @return string
*/
public function getCountry();
}
9 changes: 9 additions & 0 deletions module/Auth/src/Auth/Form/UserInfoFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ public function init()
]
]
);

$this->add(
[
'name' => 'country',
'options' => [
'label' => /*@translate*/ 'country'
]
]
);
}

/**
Expand Down
13 changes: 13 additions & 0 deletions module/Auth/test/AuthTest/Entity/InfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,19 @@ public function testSetGetHouseNumber()
$this->assertEquals($output, $this->target->getHouseNumber());
}

/**
* @testdox Allows setting the users country
* @covers Auth\Entity\Info::getCountry
* @covers Auth\Entity\Info::setCountry
*/
public function testSetGetCountry()
{
$input = 'Deutschland';
$output = 'Deutschland';
$this->target->setCountry($input);
$this->assertEquals($output, $this->target->getCountry());
}

/**
* @testdox Allows setting the users city
* @covers Auth\Entity\Info::getLastName
Expand Down
1 change: 1 addition & 0 deletions module/Auth/view/form/contact.form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<?php echo $this->formRowCombined(
array(2 => $element->get('postalCode'), 7 => $element->get('city')), null, null, $layout
);?>
<?php echo $this->formRow($element->get('country'), null, null, $layout); ?>
<?php echo $this->formRow($element->get('phone'), null, null, $layout);
echo $this->formRow($element->get('email'), null, null, $layout);?>

Expand Down
3 changes: 2 additions & 1 deletion module/Auth/view/form/contact.view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<strong><?php echo $info->getDisplayName()?></strong><br><br>
<adress>
<?php echo $info->getStreet()?> <?php echo $info->getHouseNumber()?><br>
<?php echo $info->getPostalCode()?> <?php echo $info->getCity()?>
<?php echo $info->getPostalCode()?> <?php echo $info->getCity()?><br>
<?php echo $info->getCountry()?>
</adress>
</div>
<div class="col-md-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ class OrganizationContact extends AbstractIdentifiableHydratorAwareEntity implem
* @ODM\Field(type="string") */
protected $phone;

/**
* country of an organization address
*
* @var string
* @ODM\Field(type="string") */
protected $country;

/**
* Fax number of an organization address
*
Expand Down Expand Up @@ -159,6 +166,30 @@ public function getStreet()
return $this->street;
}

/**
* Sets teh country of an organization address
*
* @param string $country
* @return OrganizationContact
*/
public function setCountry($country = "")
{
$this->country=$country;
return $this;
}

/**
* Gets the country of an organization address
*
* @return string
*/
public function getCountry()
{
return $this->country;
}



/**
* Sets a phone number of an organization address
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ public function setStreet($street = "");
*/
public function getStreet();

/**
* Sets the country of an organization address
*
* @param string $country
* @return OrganizationContact
*/
public function setCountry($country = "");

/**
* Gets the country of an organization address
*
* @return string
*/
public function getCountry();

/**
* Sets a phone number of an organization address
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ public function init()
)
)
);
$this->add(
[
'name' => 'country',
'options' => [
'label' => /* @translate */ 'Country'
]
]
);
$this->add(
array(
'name' => 'phone',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ public function testSettingValuesViaSetterMethods($setter, $getter, $value)
public function provideSetterTestValues()
{
return array(
array('setFax', 'getFax', 'test1'),
array('setPhone', 'getPhone', 'test2'),
array('setHouseNumber', 'getHouseNumber', 'test2'),
array('setStreet', 'getStreet', 'test2'),
array('setPostalcode', 'getPostalcode', 'test2'),
array('setCity', 'getCity', 'test2'),
['setFax', 'getFax', 'test1'],
['setPhone', 'getPhone', 'test2'],
['setHouseNumber', 'getHouseNumber', 'test2'],
['setStreet', 'getStreet', 'test2'],
['setPostalcode', 'getPostalcode', 'test2'],
['setCity', 'getCity', 'test2'],
['setCountry', 'getCountry', 'Deutschland'],
['setWebsite', 'getWebsite', '0815.4711'],
);
}
}

0 comments on commit f5bc459

Please sign in to comment.