diff options
author | beardyman <nornholdj@gmail.com> | 2015-10-07 15:44:44 -0400 |
---|---|---|
committer | beardyman <nornholdj@gmail.com> | 2015-10-07 15:44:44 -0400 |
commit | 63022bf7bceb6aa7116159fd347be769594fa8b4 (patch) | |
tree | a3b7e904158fe2145673a1d54676672096675a5f | |
parent | ada533a743125008474de854a3f6bcec5c104fbe (diff) | |
download | php-sparkpost-63022bf7bceb6aa7116159fd347be769594fa8b4.zip php-sparkpost-63022bf7bceb6aa7116159fd347be769594fa8b4.tar.gz php-sparkpost-63022bf7bceb6aa7116159fd347be769594fa8b4.tar.bz2 |
removed unhittable code and removed a unit test for it. Updated code coverage filters in phpunit.xml to ignore test files because a utility function wasn't being used
-rw-r--r-- | lib/SparkPost/APIResource.php | 6 | ||||
-rw-r--r-- | lib/SparkPost/SparkPost.php | 9 | ||||
-rw-r--r-- | phpunit.xml | 1 | ||||
-rw-r--r-- | test/unit/SparkPostTest.php | 5 |
4 files changed, 3 insertions, 18 deletions
diff --git a/lib/SparkPost/APIResource.php b/lib/SparkPost/APIResource.php index 3747f6d..a2cd5a6 100644 --- a/lib/SparkPost/APIResource.php +++ b/lib/SparkPost/APIResource.php @@ -48,7 +48,7 @@ class APIResource { * @param string $mapKey a dot syntax path determining which value to set * @param mixed $value value for the given path */ - protected function setMappedValue (&$model, $mapKey, $value) { + protected function setMappedValue(&$model, $mapKey, $value) { //get mapping if( empty(static::$parameterMappings) ) { // if parameterMappings is empty we can assume that no wrapper is defined @@ -180,10 +180,6 @@ class APIResource { private function callResource( $action, $resourcePath=null, $options=[] ) { $action = strtoupper($action); // normalize - if( !in_array($action, ['POST', 'PUT', 'GET', 'DELETE'])) { - throw new \Exception('Invalid resource action'); - } - $url = $this->buildUrl($resourcePath, $options); $body = $this->buildBody($options); diff --git a/lib/SparkPost/SparkPost.php b/lib/SparkPost/SparkPost.php index b3cef5e..f88d847 100644 --- a/lib/SparkPost/SparkPost.php +++ b/lib/SparkPost/SparkPost.php @@ -61,20 +61,13 @@ class SparkPost { /** * @desc Merges passed in headers with default headers for http requests - * @return Array - headers to be set on http requests */ - public function getHttpHeaders(Array $headers = null) { + public function getHttpHeaders() { $defaultOptions = [ 'Authorization' => $this->config['key'], 'Content-Type' => 'application/json', ]; - // Merge passed in headers with defaults - if (!is_null($headers)) { - foreach ($headers as $header => $value) { - $defaultOptions[$header] = $value; - } - } return $defaultOptions; } diff --git a/phpunit.xml b/phpunit.xml index e0d0cbf..66d3657 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -32,6 +32,7 @@ <filter> <blacklist> <directory>./vendor</directory> + <directory>./test</directory> </blacklist> </filter> </phpunit> diff --git a/test/unit/SparkPostTest.php b/test/unit/SparkPostTest.php index d4b1129..101784a 100644 --- a/test/unit/SparkPostTest.php +++ b/test/unit/SparkPostTest.php @@ -66,11 +66,6 @@ class SparkPostTest extends \PHPUnit_Framework_TestCase { $this->assertEquals('application/json', $results['Content-Type']); } - public function testGetHeadersOverride() { - $results = $this->resource->getHttpHeaders(['Content-Type'=>'application/xml']); - $this->assertEquals('application/xml', $results['Content-Type']); - } - public function testSetUnwrapped() { $results = $this->resource->setupUnwrapped('ASweetEndpoint'); $this->assertEquals($this->resource->ASweetEndpoint, $results); |