forked from loafle/openapi-generator-original
Switch expected and actual params in PHPUnit tests (#11992)
This commit is contained in:
parent
e268f46d76
commit
b3079f0848
@ -17,11 +17,11 @@ class DateTimeSerializerTest extends TestCase
|
|||||||
|
|
||||||
$data = ObjectSerializer::sanitizeForSerialization($input);
|
$data = ObjectSerializer::sanitizeForSerialization($input);
|
||||||
|
|
||||||
$this->assertEquals($data->dateTime, '1973-04-30T17:05:00+02:00');
|
$this->assertEquals('1973-04-30T17:05:00+02:00', $data->dateTime);
|
||||||
|
|
||||||
ObjectSerializer::setDateTimeFormat(\DateTime::RFC3339_EXTENDED);
|
ObjectSerializer::setDateTimeFormat(\DateTime::RFC3339_EXTENDED);
|
||||||
$dataFraction = ObjectSerializer::sanitizeForSerialization($input);
|
$dataFraction = ObjectSerializer::sanitizeForSerialization($input);
|
||||||
$this->assertEquals($dataFraction->dateTime, '1973-04-30T17:05:00.000+02:00');
|
$this->assertEquals('1973-04-30T17:05:00.000+02:00', $dataFraction->dateTime);
|
||||||
ObjectSerializer::setDateTimeFormat(\DateTime::ATOM);
|
ObjectSerializer::setDateTimeFormat(\DateTime::ATOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,6 +35,6 @@ class DateTimeSerializerTest extends TestCase
|
|||||||
|
|
||||||
$data = ObjectSerializer::sanitizeForSerialization($input);
|
$data = ObjectSerializer::sanitizeForSerialization($input);
|
||||||
|
|
||||||
$this->assertEquals($data->date, '1973-04-30');
|
$this->assertEquals('1973-04-30', $data->date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,13 +60,13 @@ class PetApiTest extends TestCase
|
|||||||
$petId = 10005;
|
$petId = 10005;
|
||||||
|
|
||||||
$pet = $this->api->getPetById($petId);
|
$pet = $this->api->getPetById($petId);
|
||||||
$this->assertSame($pet->getId(), $petId);
|
$this->assertSame($petId, $pet->getId());
|
||||||
$this->assertSame($pet->getName(), 'PHP Unit Test');
|
$this->assertSame('PHP Unit Test', $pet->getName());
|
||||||
$this->assertSame($pet->getPhotoUrls()[0], 'http://test_php_unit_test.com');
|
$this->assertSame('http://test_php_unit_test.com', $pet->getPhotoUrls()[0]);
|
||||||
$this->assertSame($pet->getCategory()->getId(), $petId);
|
$this->assertSame($petId, $pet->getCategory()->getId());
|
||||||
$this->assertSame($pet->getCategory()->getName(), 'test php category');
|
$this->assertSame('test php category', $pet->getCategory()->getName());
|
||||||
$this->assertSame($pet->getTags()[0]->getId(), $petId);
|
$this->assertSame($petId, $pet->getTags()[0]->getId());
|
||||||
$this->assertSame($pet->getTags()[0]->getName(), 'test php tag');
|
$this->assertSame('test php tag', $pet->getTags()[0]->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,14 +105,14 @@ class PetApiTest extends TestCase
|
|||||||
|
|
||||||
/** @var $pet Pet */
|
/** @var $pet Pet */
|
||||||
list($pet, $status_code, $response_headers) = $this->api->getPetByIdWithHttpInfo($petId);
|
list($pet, $status_code, $response_headers) = $this->api->getPetByIdWithHttpInfo($petId);
|
||||||
$this->assertSame($pet->getId(), $petId);
|
$this->assertSame($petId, $pet->getId());
|
||||||
$this->assertSame($pet->getName(), 'PHP Unit Test');
|
$this->assertSame('PHP Unit Test', $pet->getName());
|
||||||
$this->assertSame($pet->getCategory()->getId(), $petId);
|
$this->assertSame($petId, $pet->getCategory()->getId());
|
||||||
$this->assertSame($pet->getCategory()->getName(), 'test php category');
|
$this->assertSame('test php category', $pet->getCategory()->getName());
|
||||||
$this->assertSame($pet->getTags()[0]->getId(), $petId);
|
$this->assertSame($petId, $pet->getTags()[0]->getId());
|
||||||
$this->assertSame($pet->getTags()[0]->getName(), 'test php tag');
|
$this->assertSame('test php tag', $pet->getTags()[0]->getName());
|
||||||
$this->assertSame($status_code, 200);
|
$this->assertSame(200, $status_code);
|
||||||
$this->assertSame($response_headers['Content-Type'], ['application/json']);
|
$this->assertSame(['application/json'], $response_headers['Content-Type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFindPetByStatus()
|
public function testFindPetByStatus()
|
||||||
@ -120,9 +120,9 @@ class PetApiTest extends TestCase
|
|||||||
$response = $this->api->findPetsByStatus('available');
|
$response = $this->api->findPetsByStatus('available');
|
||||||
$this->assertGreaterThan(0, count($response)); // at least one object returned
|
$this->assertGreaterThan(0, count($response)); // at least one object returned
|
||||||
|
|
||||||
$this->assertSame(get_class($response[0]), Pet::class); // verify the object is Pet
|
$this->assertInstanceOf(Pet::class, $response[0]); // verify the object is Pet
|
||||||
foreach ($response as $pet) {
|
foreach ($response as $pet) {
|
||||||
$this->assertSame($pet->getStatus(), 'available');
|
$this->assertSame('available', $pet->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->api->findPetsByStatus('unknown_and_incorrect_status');
|
$response = $this->api->findPetsByStatus('unknown_and_incorrect_status');
|
||||||
@ -141,9 +141,9 @@ class PetApiTest extends TestCase
|
|||||||
|
|
||||||
// verify updated Pet
|
// verify updated Pet
|
||||||
$result = $this->api->getPetById($petId);
|
$result = $this->api->getPetById($petId);
|
||||||
$this->assertSame($result->getId(), $petId);
|
$this->assertSame($petId, $result->getId());
|
||||||
$this->assertSame($result->getStatus(), 'pending');
|
$this->assertSame('pending', $result->getStatus());
|
||||||
$this->assertSame($result->getName(), 'updatePet');
|
$this->assertSame('updatePet', $result->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// test updatePetWithFormWithHttpInfo and verify by the "name" of the response
|
// test updatePetWithFormWithHttpInfo and verify by the "name" of the response
|
||||||
@ -158,11 +158,11 @@ class PetApiTest extends TestCase
|
|||||||
);
|
);
|
||||||
// return nothing (void)
|
// return nothing (void)
|
||||||
$this->assertNull($update_response);
|
$this->assertNull($update_response);
|
||||||
$this->assertSame($status_code, 200);
|
$this->assertSame(200, $status_code);
|
||||||
$this->assertSame($http_headers['Content-Type'], ['application/json']);
|
$this->assertSame(['application/json'], $http_headers['Content-Type']);
|
||||||
$response = $this->api->getPetById($petId);
|
$response = $this->api->getPetById($petId);
|
||||||
$this->assertSame($response->getId(), $petId);
|
$this->assertSame($petId, $response->getId());
|
||||||
$this->assertSame($response->getName(), 'update pet with form with http info');
|
$this->assertSame('update pet with form with http info', $response->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// test updatePetWithForm and verify by the "name" and "status" of the response
|
// test updatePetWithForm and verify by the "name" and "status" of the response
|
||||||
@ -174,9 +174,9 @@ class PetApiTest extends TestCase
|
|||||||
$this->assertNull($result);
|
$this->assertNull($result);
|
||||||
|
|
||||||
$response = $this->api->getPetById($pet_id);
|
$response = $this->api->getPetById($pet_id);
|
||||||
$this->assertSame($response->getId(), $pet_id);
|
$this->assertSame($pet_id, $response->getId());
|
||||||
$this->assertSame($response->getName(), 'update pet with form');
|
$this->assertSame('update pet with form', $response->getName());
|
||||||
$this->assertSame($response->getStatus(), 'sold');
|
$this->assertSame('sold', $response->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
// test addPet and verify by the "id" and "name" of the response
|
// test addPet and verify by the "id" and "name" of the response
|
||||||
@ -194,8 +194,8 @@ class PetApiTest extends TestCase
|
|||||||
|
|
||||||
// verify added Pet
|
// verify added Pet
|
||||||
$response = $this->api->getPetById($new_pet_id);
|
$response = $this->api->getPetById($new_pet_id);
|
||||||
$this->assertSame($response->getId(), $new_pet_id);
|
$this->assertSame($new_pet_id, $response->getId());
|
||||||
$this->assertSame($response->getName(), 'PHP Unit Test 2');
|
$this->assertSame('PHP Unit Test 2', $response->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user