diff --git a/composer.json b/composer.json index 8e2ed0d1..5274621a 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,8 @@ "firebase/php-jwt": "^5.0 || ^6.0" }, "require-dev": { - "phpunit/phpunit": "~4.8", - "satooshi/php-coveralls": "~1.0", + "phpunit/phpunit": "~9.0", + "php-coveralls/php-coveralls": "~2.0", "squizlabs/php_codesniffer": "~2.6", "friendsofphp/php-cs-fixer": "*" }, @@ -34,6 +34,6 @@ "psr-4": { "DocuSign\\eSign\\" : "src/" } }, "autoload-dev": { - "psr-4": { "DocuSign\\eSign\\" : "test/" } + "psr-4": { "DocuSign\\eSign\\Test\\" : "test/" } } } diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php index fb900962..f6fea4f3 100644 --- a/src/ObjectSerializer.php +++ b/src/ObjectSerializer.php @@ -271,7 +271,11 @@ public static function deserialize($data, string $class, ?array $httpHeaders = n } else { return null; } - } elseif (in_array($class, ['?bool', '?int', '?string', 'DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + } elseif ($class === 'DateTime' || in_array(strtolower($class), ['?bool', '?int', '?string', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'object', 'string', 'void'], true)) { + $class = $class !== 'DateTime' ? strtolower($class) : $class; + if ($class === 'void') { + $class = 'null'; + } $class=trim($class,"?"); settype($data, $class); return $data; @@ -305,6 +309,9 @@ public static function deserialize($data, string $class, ?array $httpHeaders = n return $data; } else { // If a discriminator is defined and points to a valid subclass, use it. + if (in_array($class, ['Number', 'Date'])) { + $class = '\DocuSign\eSign\Model\\' . $class; + } $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { $subclass = 'DocuSign\eSign\Model\\' . $data->{$discriminator}; diff --git a/test/OAuthTests.php b/test/OAuthTests.php index e09d50ea..56eeb58f 100644 --- a/test/OAuthTests.php +++ b/test/OAuthTests.php @@ -1,6 +1,9 @@ setApiClient(new DocuSign\eSign\Client\ApiClient()); + $testConfig->setApiClient(new ApiClient()); $this->config = $testConfig; $oAuth = $this->config->getApiClient()->getOAuth(); $oAuth->setBasePath($testConfig->getHost()); $this->scope = [ - DocuSign\eSign\Client\ApiClient::$SCOPE_SIGNATURE, - DocuSign\eSign\Client\ApiClient::$SCOPE_IMPERSONATION + ApiClient::$SCOPE_SIGNATURE, + ApiClient::$SCOPE_IMPERSONATION ]; } public function testOauthUri() { $uri = $this->config->getApiClient()->getAuthorizationURI($this->config->getIntegratorKey(), $this->scope, $this->config->getReturnUrl(), 'code'); - $this->assertStringEndsWith($this->config->getReturnUrl(), $uri); + self::assertStringEndsWith($this->config->getReturnUrl(), $uri); echo $uri; } public function testJwtUser() { $token = $this->config->getApiClient()->requestJWTUserToken($this->config->getIntegratorKey(), $this->config->getUserId(), $this->config->getClientKey(), $this->scope); - $this->assertInstanceOf('DocuSign\eSign\Client\Auth\OAuthToken', $token[0]); + self::assertInstanceOf('DocuSign\eSign\Client\Auth\OAuthToken', $token[0]); } public function testJwtApplication() { $token = $this->config->getApiClient()->requestJWTApplicationToken($this->config->getIntegratorKey(), $this->config->getClientKey(), $this->scope); - $this->assertInstanceOf('DocuSign\eSign\Client\Auth\OAuthToken', $token[0]); + self::assertInstanceOf('DocuSign\eSign\Client\Auth\OAuthToken', $token[0]); } /** @@ -68,13 +71,13 @@ public function testAuthorizationCodeLogin() # $code = ''; # $token = $this->config->getApiClient()->generateAccessToken($this->config->getIntegratorKey(), $this->config->getClientSecret(), $code); - # $this->assertInstanceOf('DocuSign\eSign\Client\Auth\OAuthToken', $token[0]); + # self::assertInstanceOf('DocuSign\eSign\Client\Auth\OAuthToken', $token[0]); # echo $token[0]; # $user = $this->config->getApiClient()->getUserInfo($token[0]['access_token']); - # $this->assertInstanceOf('DocuSign\eSign\Client\Auth\UserInfo', $user[0]); - # $this->assertSame(200, $user[1]); + # self::assertInstanceOf('DocuSign\eSign\Client\Auth\UserInfo', $user[0]); + # self::assertSame(200, $user[1]); # $loginAccount = $user[0]['accounts'][0]; # if (isset($loginInformation)) { @@ -87,5 +90,3 @@ public function testAuthorizationCodeLogin() } - -?> \ No newline at end of file diff --git a/test/TestConfig.php b/test/TestConfig.php index ae8586e2..93322353 100644 --- a/test/TestConfig.php +++ b/test/TestConfig.php @@ -1,4 +1,5 @@ envelope; } @@ -497,7 +498,7 @@ public function setEnvelope($envelope) } /** - * @param Model\EnvelopeTemplate $template + * @param EnvelopeTemplate $template */ public function setTemplate(EnvelopeTemplate $template) { @@ -506,7 +507,7 @@ public function setTemplate(EnvelopeTemplate $template) } /** - * @return Model\EnvelopeTemplate + * @return EnvelopeTemplate */ public function getTemplate() { diff --git a/test/UnitTests.php b/test/UnitTests.php index b5ad57ad..34fc8925 100644 --- a/test/UnitTests.php +++ b/test/UnitTests.php @@ -1,5 +1,7 @@ getDocument($testConfig->getAccountId(), $document->getDocumentId(), $testConfig->getEnvelopeId()); $this->assertNotEmpty($addedDocument); - $this->assertInstanceOf(SplFileObject::class, $addedDocument); + $this->assertInstanceOf(\SplFileObject::class, $addedDocument); } /** @@ -1670,7 +1672,7 @@ public function testUpdateBrandResourcesByContentTypeTest($testConfig) { $accountsApi = new AccountsApi($testConfig->getApiClient()); $brandFile = "/Docs/brand.xml"; - $brandResources = $accountsApi->updateBrandResourcesByContentType($testConfig->getAccountId(),$testConfig->getBrandId(),'email',new SplFileObject(__DIR__ . $brandFile)); + $brandResources = $accountsApi->updateBrandResourcesByContentType($testConfig->getAccountId(),$testConfig->getBrandId(),'email',new \SplFileObject(__DIR__ . $brandFile)); $this->assertNotEmpty($brandResources); $this->assertInstanceOf('DocuSign\eSign\Model\BrandResources', $brandResources); @@ -1694,5 +1696,3 @@ public function testRecipientsUpdate($testConfig) return $testConfig; } } - -?> diff --git a/test/phpunit.xml b/test/phpunit.xml index 476a4299..861bf301 100644 --- a/test/phpunit.xml +++ b/test/phpunit.xml @@ -1,21 +1,15 @@ - - - - ./ - - - - - - ./src/Api - ./src/Client - ./src/Model - - + + + + ./src/Api + ./src/Client + ./src/Model + + + + + ./ + +