Skip to content

Commit

Permalink
[PHP] Improve: update sample tests automatically (#7717)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
ackintosh authored and wing328 committed Mar 8, 2018
1 parent 32cf2f1 commit 0adbf7e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 58 deletions.
6 changes: 6 additions & 0 deletions bin/php-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ then
mvn clean package
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.
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 $@"
Expand Down
6 changes: 6 additions & 0 deletions bin/security/php-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ then
mvn clean package
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.
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,19 @@
*
* @category Class
* @package Swagger\Client
* @author https://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @author Swagger Codegen team
* @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
* Contact: [email protected] *_/ ' \" =end \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
* Swagger Codegen version: 2.4.0-SNAPSHOT
*/

/**
Expand All @@ -41,7 +29,6 @@
namespace Swagger\Client;

use \Swagger\Client\Configuration;
use \Swagger\Client\ApiClient;
use \Swagger\Client\ApiException;
use \Swagger\Client\ObjectSerializer;

Expand All @@ -50,8 +37,7 @@
*
* @category Class
* @package Swagger\Client
* @author https://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class FakeApiTest extends \PHPUnit_Framework_TestCase
Expand All @@ -62,42 +48,36 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase
*/
public static function setUpBeforeClass()
{

}

/**
* Setup before running each test case
*/
public function setUp()
{

}

/**
* Clean up after running each test case
*/
public function tearDown()
{

}

/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{

}

/**
* 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()
{

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,19 @@
*
* @category Class
* @package Swagger\Client
* @author https://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @author Swagger Codegen team
* @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
* Contact: [email protected] *_/ ' \" =end \\r\\n \\n \\r
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*
* 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.
* Swagger Codegen version: 2.4.0-SNAPSHOT
*/

/**
Expand All @@ -44,12 +32,10 @@
/**
* ModelReturnTest Class Doc Comment
*
* @category Class */
// * @description Model for testing reserved words *_/ ' \" =end \\r\\n \\n \\r
/**
* @category Class
* @description Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
* @package Swagger\Client
* @author https://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class ModelReturnTest extends \PHPUnit_Framework_TestCase
Expand All @@ -60,47 +46,40 @@ class ModelReturnTest extends \PHPUnit_Framework_TestCase
*/
public static function setUpBeforeClass()
{

}

/**
* Setup before running each test case
*/
public function setUp()
{

}

/**
* Clean up after running each test case
*/
public function tearDown()
{

}

/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{

}

/**
* Test "ModelReturn"
*/
public function testModelReturn()
{

}

/**
* Test attribute "return"
*/
public function testPropertyReturn()
{

}

}

0 comments on commit 0adbf7e

Please sign in to comment.