[PHP] Improve: update sample tests automatically (#7717)

* Improve: update sample tests automatically

* security test

* Update sample

- bin/php-petstore.sh
- bin/security/php-petstore.sh

The security test has not been updated for a while.
This commit is contained in:
Akihito Nakano 2018-03-08 22:56:48 +09:00 committed by William Cheng
parent 32cf2f16f5
commit 0adbf7e51f
4 changed files with 29 additions and 58 deletions

View File

@ -24,6 +24,12 @@ then
mvn clean package mvn clean package
fi fi
# cleanup tests
TEST_DIR="./samples/client/petstore/php/SwaggerClient-php/test"
if [ -d $TEST_DIR ]; then
rm -rf $TEST_DIR
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l php -o samples/client/petstore/php $@" ags="generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l php -o samples/client/petstore/php $@"

View File

@ -24,6 +24,12 @@ then
mvn clean package mvn clean package
fi fi
# cleanup tests
TEST_DIR="./samples/client/petstore-security-test/php/SwaggerClient-php/test"
if [ -d $TEST_DIR ]; then
rm -rf $TEST_DIR
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l php -o samples/client/petstore-security-test/php" ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l php -o samples/client/petstore-security-test/php"

View File

@ -5,31 +5,19 @@
* *
* @category Class * @category Class
* @package Swagger\Client * @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen * @author Swagger Codegen team
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @link https://github.com/swagger-api/swagger-codegen * @link https://github.com/swagger-api/swagger-codegen
*/ */
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* *
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
* *
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
* * Swagger Codegen version: 2.4.0-SNAPSHOT
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
/** /**
@ -41,7 +29,6 @@
namespace Swagger\Client; namespace Swagger\Client;
use \Swagger\Client\Configuration; use \Swagger\Client\Configuration;
use \Swagger\Client\ApiClient;
use \Swagger\Client\ApiException; use \Swagger\Client\ApiException;
use \Swagger\Client\ObjectSerializer; use \Swagger\Client\ObjectSerializer;
@ -50,8 +37,7 @@ use \Swagger\Client\ObjectSerializer;
* *
* @category Class * @category Class
* @package Swagger\Client * @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen * @author Swagger Codegen team
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @link https://github.com/swagger-api/swagger-codegen * @link https://github.com/swagger-api/swagger-codegen
*/ */
class FakeApiTest extends \PHPUnit_Framework_TestCase class FakeApiTest extends \PHPUnit_Framework_TestCase
@ -62,7 +48,6 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
*/ */
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
} }
/** /**
@ -70,7 +55,6 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
*/ */
public function setUp() public function setUp()
{ {
} }
/** /**
@ -78,7 +62,6 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
*/ */
public function tearDown() public function tearDown()
{ {
} }
/** /**
@ -86,18 +69,15 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
*/ */
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
} }
/** /**
* Test case for testCodeInjectEndRnNR * Test case for testCodeInjectEndRnNR
* *
* To test code injection *_/ ' \" =end \\r\\n \\n \\r. * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r.
* *
*/ */
public function testTestCodeInjectEndRnNR() public function testTestCodeInjectEndRnNR()
{ {
} }
} }

View File

@ -6,31 +6,19 @@
* *
* @category Class * @category Class
* @package Swagger\Client * @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen * @author Swagger Codegen team
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @link https://github.com/swagger-api/swagger-codegen * @link https://github.com/swagger-api/swagger-codegen
*/ */
/** /**
* Swagger Petstore *_/ ' \" =end \\r\\n \\n \\r * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* *
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
* *
* OpenAPI spec version: 1.0.0 *_/ ' \" =end \\r\\n \\n \\r * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end \\r\\n \\n \\r * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git * Generated by: https://github.com/swagger-api/swagger-codegen.git
* * Swagger Codegen version: 2.4.0-SNAPSHOT
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
/** /**
@ -44,12 +32,10 @@ namespace Swagger\Client;
/** /**
* ModelReturnTest Class Doc Comment * ModelReturnTest Class Doc Comment
* *
* @category Class */ * @category Class
// * @description Model for testing reserved words *_/ ' \" =end \\r\\n \\n \\r * @description Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
/**
* @package Swagger\Client * @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen * @author Swagger Codegen team
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @link https://github.com/swagger-api/swagger-codegen * @link https://github.com/swagger-api/swagger-codegen
*/ */
class ModelReturnTest extends \PHPUnit_Framework_TestCase class ModelReturnTest extends \PHPUnit_Framework_TestCase
@ -60,7 +46,6 @@ class ModelReturnTest extends \PHPUnit_Framework_TestCase
*/ */
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
} }
/** /**
@ -68,7 +53,6 @@ class ModelReturnTest extends \PHPUnit_Framework_TestCase
*/ */
public function setUp() public function setUp()
{ {
} }
/** /**
@ -76,7 +60,6 @@ class ModelReturnTest extends \PHPUnit_Framework_TestCase
*/ */
public function tearDown() public function tearDown()
{ {
} }
/** /**
@ -84,7 +67,6 @@ class ModelReturnTest extends \PHPUnit_Framework_TestCase
*/ */
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
} }
/** /**
@ -92,7 +74,6 @@ class ModelReturnTest extends \PHPUnit_Framework_TestCase
*/ */
public function testModelReturn() public function testModelReturn()
{ {
} }
/** /**
@ -100,7 +81,5 @@ class ModelReturnTest extends \PHPUnit_Framework_TestCase
*/ */
public function testPropertyReturn() public function testPropertyReturn()
{ {
} }
} }