-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add several tests * Move tests in correct folder. * Extends tests
- Loading branch information
David Pauli
authored
Oct 26, 2016
1 parent
07f6431
commit c6f20bc
Showing
21 changed files
with
820 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,10 +69,12 @@ class Address { | |
*/ | ||
public function __construct($addressParameter) { | ||
|
||
self::errorReset(); | ||
|
||
// if parameter is no array | ||
if (!InputValidator::isArray($addressParameter)) { | ||
|
||
$this->errorSet("D-1"); | ||
self::errorSet("A-1"); | ||
Logger::error("ep6\Address\nThe address parameter " . $addressParameter . " is no array."); | ||
return; | ||
} | ||
|
@@ -229,6 +231,19 @@ public function getCompany() { | |
return $this->company; | ||
} | ||
|
||
/** | ||
* Returns the country. | ||
* | ||
* @author David Pauli <[email protected]> | ||
* @return String The country. | ||
* @since 0.2.1 | ||
*/ | ||
public function getCountry() { | ||
|
||
self::errorReset(); | ||
return $this->country; | ||
} | ||
|
||
/** | ||
* Returns the email address. | ||
* | ||
|
@@ -408,6 +423,19 @@ public function setCompany($company) { | |
$this->company = $company; | ||
} | ||
|
||
/** | ||
* Sets the country. | ||
* | ||
* @author David Pauli <[email protected]> | ||
* @param String $country The country. | ||
* @since 0.2.1 | ||
*/ | ||
public function setCountry($country) { | ||
|
||
self::errorReset(); | ||
$this->country = $country; | ||
} | ||
|
||
/** | ||
* Sets the email address. | ||
* | ||
|
@@ -454,10 +482,10 @@ public function setLastName($lastName) { | |
* @param String $salutation The salutation. | ||
* @since 0.2.0 | ||
*/ | ||
public function setSalutation($saluation) { | ||
public function setSalutation($salutation) { | ||
|
||
self::errorReset(); | ||
$this->salutation = $lastName; | ||
$this->salutation = $salutation; | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ class RESTClient { | |
const PATHTOREST = "rs/shops"; | ||
|
||
/** @var String The user agent. */ | ||
const USER_AGENT = "ePages REST SDk"; | ||
const USER_AGENT = "ePages REST SDK"; | ||
|
||
/** @var int The time in ms the shop object should wait until the next request. */ | ||
public static $NEXT_RESPONSE_WAIT_TIME = 600; | ||
|
@@ -82,13 +82,13 @@ class RESTClient { | |
public static function connect($host, $shop, $authToken = null, $isssl = true) { | ||
|
||
self::errorReset(); | ||
self::disconnect(); | ||
|
||
// check parameters | ||
if (!InputValidator::isHost($host) || | ||
!InputValidator::isShop($shop)) { | ||
|
||
Logger::warning("ep6\RESTClient\nHost (" . $host . ") or Shop (" . $shop . ") are not valid."); | ||
self::disconnect(); | ||
$error = !InputValidator::isHost($host) ? "RESTC-1" : "RESTC-2"; | ||
self::errorSet($error); | ||
return false; | ||
|
@@ -255,18 +255,6 @@ public static function getJSONContent() { | |
return JSONHandler::parseJSON(self::$CONTENT); | ||
} | ||
|
||
/** | ||
* Gets the Location header of response. | ||
* | ||
* @author David Pauli <[email protected]> | ||
* @return String The Location header of last response. | ||
* @since 0.2.1 | ||
*/ | ||
public static function getLocation() { | ||
|
||
return self::$LOCATION; | ||
} | ||
|
||
/** | ||
* Returns if the last response was 200 OK. | ||
* | ||
|
@@ -539,6 +527,7 @@ public static function resetLastResponse() { | |
self::$CONTENT_TYPE = null; | ||
self::$DATE = null; | ||
self::$HTTP_RESPONSE_CODE = 0; | ||
self::$HEADERS = array(); | ||
} | ||
|
||
/** | ||
|
Oops, something went wrong.