mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 18:45:23 +00:00
[PHP] Cleanup StoreApiTest (#7248)
* Move test codes in "test" to "tests". * Simplify class name specification * Regenerate test/Api/StoreApiTest.php testGetInventory already exists in tests/StoreApiTest.php
This commit is contained in:
parent
ee5709177a
commit
4e5ec4c71c
@ -5,8 +5,7 @@
|
|||||||
*
|
*
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -18,18 +17,7 @@
|
|||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
* Contact: apiteam@swagger.io
|
||||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||||
*
|
* Swagger Codegen version: 2.3.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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,10 +26,9 @@
|
|||||||
* Please update the test case below to test the endpoint.
|
* Please update the test case below to test the endpoint.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Swagger\Client\Api;
|
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,53 +37,38 @@ 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 StoreApiTest extends \PHPUnit_Framework_TestCase
|
class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup before running each test case
|
* Setup before running any test cases
|
||||||
*/
|
*/
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
}
|
||||||
|
|
||||||
// for error reporting (need to run with php5.3 to get no warning)
|
/**
|
||||||
//ini_set('display_errors', 1);
|
* Setup before running each test case
|
||||||
//error_reporting(~0);
|
*/
|
||||||
|
public function setUp()
|
||||||
// new pet
|
{
|
||||||
$new_pet_id = 10005;
|
|
||||||
$new_pet = new \Swagger\Client\Model\Pet;
|
|
||||||
$new_pet->setId($new_pet_id);
|
|
||||||
$new_pet->setName("PHP Unit Test");
|
|
||||||
$new_pet->setStatus("available");
|
|
||||||
// new tag
|
|
||||||
$tag= new \Swagger\Client\Model\Tag;
|
|
||||||
$tag->setId($new_pet_id); // use the same id as pet
|
|
||||||
$tag->setName("test php tag");
|
|
||||||
// new category
|
|
||||||
$category = new \Swagger\Client\Model\Category;
|
|
||||||
$category->setId($new_pet_id); // use the same id as pet
|
|
||||||
$category->setName("test php category");
|
|
||||||
|
|
||||||
$new_pet->setTags(array($tag));
|
|
||||||
$new_pet->setCategory($category);
|
|
||||||
|
|
||||||
$pet_api = new PetApi();
|
|
||||||
// add a new pet (model)
|
|
||||||
$add_response = $pet_api->addPet($new_pet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up after running each test case
|
* Clean up after running each test case
|
||||||
*/
|
*/
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up after running all test cases
|
||||||
|
*/
|
||||||
public static function tearDownAfterClass()
|
public static function tearDownAfterClass()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +79,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDeleteOrder()
|
public function testDeleteOrder()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,13 +89,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testGetInventory()
|
public function testGetInventory()
|
||||||
{
|
{
|
||||||
// initialize the API client
|
|
||||||
$store_api = new StoreApi();
|
|
||||||
// get inventory
|
|
||||||
$get_response = $store_api->getInventory();
|
|
||||||
|
|
||||||
$this->assertInternalType("array", $get_response);
|
|
||||||
$this->assertInternalType("int", $get_response['available']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,7 +99,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testGetOrderById()
|
public function testGetOrderById()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +109,5 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testPlaceOrder()
|
public function testPlaceOrder()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
namespace Swagger\Client;
|
namespace Swagger\Client;
|
||||||
|
|
||||||
|
use Swagger\Client\Api\PetApi;
|
||||||
use Swagger\Client\Api\StoreApi;
|
use Swagger\Client\Api\StoreApi;
|
||||||
|
use Swagger\Client\Model\Category;
|
||||||
|
use Swagger\Client\Model\Pet;
|
||||||
|
use Swagger\Client\Model\Tag;
|
||||||
|
|
||||||
class StoreApiTest extends \PHPUnit_Framework_TestCase
|
class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -11,7 +15,35 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->api = new Api\StoreApi();
|
$this->api = new StoreApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup before running each test case
|
||||||
|
*/
|
||||||
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
// add a new pet (id 10005) to ensure the pet object is available for all the tests
|
||||||
|
// new pet
|
||||||
|
$id = 10005;
|
||||||
|
$pet = new Pet();
|
||||||
|
$pet->setId($id);
|
||||||
|
$pet->setName('PHP Unit Test');
|
||||||
|
$pet->setStatus('available');
|
||||||
|
// new tag
|
||||||
|
$tag = new Tag();
|
||||||
|
$tag->setId($id); // use the same id as pet
|
||||||
|
$tag->setName('test php tag');
|
||||||
|
// new category
|
||||||
|
$category = new Category();
|
||||||
|
$category->setId($id); // use the same id as pet
|
||||||
|
$category->setName('test php category');
|
||||||
|
|
||||||
|
$pet->setTags([$tag]);
|
||||||
|
$pet->setCategory($category);
|
||||||
|
|
||||||
|
$api = new PetApi();
|
||||||
|
$api->addPet($pet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetInventory()
|
public function testGetInventory()
|
||||||
|
Loading…
Reference in New Issue
Block a user