From ddc4d8460d504d271b02d061c3319fd2950f5891 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 25 Nov 2015 00:00:26 +0800 Subject: [PATCH] fix php access token setter --- .../src/main/resources/php/configuration.mustache | 2 +- .../petstore/php/SwaggerClient-php/lib/Configuration.php | 2 +- .../petstore/php/SwaggerClient-php/tests/PetApiTest.php | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/configuration.mustache b/modules/swagger-codegen/src/main/resources/php/configuration.mustache index 14d7957fe5..28082851c0 100644 --- a/modules/swagger-codegen/src/main/resources/php/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/php/configuration.mustache @@ -211,7 +211,7 @@ class Configuration */ public function setAccessToken($accessToken) { - $this->$accessToken = $accessToken; + $this->accessToken = $accessToken; return $this; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php index 1fdac785bf..033f2da7a2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php @@ -211,7 +211,7 @@ class Configuration */ public function setAccessToken($accessToken) { - $this->$accessToken = $accessToken; + $this->accessToken = $accessToken; return $this; } diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index fe818069da..58d5cd661f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -82,6 +82,10 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertNotEquals($apiClient3, $apiClient4); // customied pet api not using the old pet api's api client $this->assertNotEquals($pet_api2->getApiClient(), $pet_api3->getApiClient()); + + // test access token + $api_client->getConfig()->setAccessToken("testing_only"); + $this->assertSame('testing_only', $api_client->getConfig()->getAccessToken()); } // test getPetById with a Pet object (id 10005)