Skip to content

Commit 9786bf4

Browse files
committed
Refactored some tests and fixed wrong names.
1 parent fd599b3 commit 9786bf4

File tree

7 files changed

+74
-27
lines changed

7 files changed

+74
-27
lines changed

src/Request/Mod/ModMetaRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
class ModMetaRequest implements RequestInterface
1919
{
20-
2120
/**
2221
* Returns the path of the request, relative to the API URL.
2322
* @return string

tests/src/Response/Generic/GenericDetailsResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
class GenericDetailsResponseTest extends TestCase
2121
{
2222
/**
23-
* Tests mapping and getting the authorization token.
23+
* Tests mapping and getting entities.
2424
* @covers ::getEntities
2525
* @covers ::mapResponse
2626
*/
27-
public function testGetAuthorizationToken()
27+
public function testGetEntities()
2828
{
2929
$responseData = [
3030
'entities' => [

tests/src/Response/Generic/GenericIconResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
class GenericIconResponseTest extends TestCase
2121
{
2222
/**
23-
* Tests mapping and getting the authorization token.
23+
* Tests mapping and getting the icons.
2424
* @covers ::getIcons
2525
* @covers ::mapResponse
2626
*/
27-
public function testGetAuthorizationToken()
27+
public function testGetIcons()
2828
{
2929
$responseData = [
3030
'icons' => [

tests/src/Response/Item/ItemIngredientResponseTest.php

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,58 @@
2121
class ItemIngredientResponseTest extends TestCase
2222
{
2323
/**
24-
* Tests mapping and getting the authorization token.
24+
* Tests mapping and getting the item.
2525
* @covers ::getItem
26-
* @covers ::getGroupedRecipes
27-
* @covers ::getTotalNumberOfResults
2826
* @covers ::mapResponse
2927
*/
30-
public function testGetAuthorizationToken()
28+
public function testGetItem()
3129
{
3230
$responseData = [
3331
'item' => [
3432
'name' => 'abc'
35-
],
33+
]
34+
];
35+
$item = new Item();
36+
$item->setName('abc');
37+
38+
$response = new ItemIngredientResponse(new TestPendingResponse($responseData));
39+
$this->assertEquals($item, $response->getItem());
40+
}
41+
42+
/**
43+
* Tests mapping and getting the grouped recipes.
44+
* @covers ::getGroupedRecipes
45+
* @covers ::mapResponse
46+
*/
47+
public function testGetGroupedRecipes()
48+
{
49+
$responseData = [
3650
'groupedRecipes' => [
3751
['name' => 'def'],
3852
['name' => 'ghi']
3953
],
40-
'totalNumberOfResults' => 42
4154
];
42-
$item = new Item();
43-
$item->setName('abc');
4455
$recipe1 = new GenericEntityWithRecipes();
4556
$recipe1->setName('def');
4657
$recipe2 = new GenericEntityWithRecipes();
4758
$recipe2->setName('ghi');
4859

4960
$response = new ItemIngredientResponse(new TestPendingResponse($responseData));
50-
$this->assertEquals($item, $response->getItem());
5161
$this->assertEquals([$recipe1, $recipe2], $response->getGroupedRecipes());
62+
}
63+
64+
/**
65+
* Tests mapping and getting the total number of results.
66+
* @covers ::getTotalNumberOfResults
67+
* @covers ::mapResponse
68+
*/
69+
public function testGetTotalNumberOfResults()
70+
{
71+
$responseData = [
72+
'totalNumberOfResults' => 42
73+
];
74+
75+
$response = new ItemIngredientResponse(new TestPendingResponse($responseData));
5276
$this->assertEquals(42, $response->getTotalNumberOfResults());
5377
}
5478

tests/src/Response/Item/ItemProductResponseTest.php

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,58 @@
2121
class ItemProductResponseTest extends TestCase
2222
{
2323
/**
24-
* Tests mapping and getting the authorization token.
24+
* Tests mapping and getting the item.
2525
* @covers ::getItem
26-
* @covers ::getGroupedRecipes
27-
* @covers ::getTotalNumberOfResults
2826
* @covers ::mapResponse
2927
*/
30-
public function testGetAuthorizationToken()
28+
public function testGetItem()
3129
{
3230
$responseData = [
3331
'item' => [
3432
'name' => 'abc'
35-
],
33+
]
34+
];
35+
$item = new Item();
36+
$item->setName('abc');
37+
38+
$response = new ItemProductResponse(new TestPendingResponse($responseData));
39+
$this->assertEquals($item, $response->getItem());
40+
}
41+
42+
/**
43+
* Tests mapping and getting the grouped recipes.
44+
* @covers ::getGroupedRecipes
45+
* @covers ::mapResponse
46+
*/
47+
public function testGetGroupedRecipes()
48+
{
49+
$responseData = [
3650
'groupedRecipes' => [
3751
['name' => 'def'],
3852
['name' => 'ghi']
3953
],
40-
'totalNumberOfResults' => 42
4154
];
42-
$item = new Item();
43-
$item->setName('abc');
4455
$recipe1 = new GenericEntityWithRecipes();
4556
$recipe1->setName('def');
4657
$recipe2 = new GenericEntityWithRecipes();
4758
$recipe2->setName('ghi');
4859

4960
$response = new ItemProductResponse(new TestPendingResponse($responseData));
50-
$this->assertEquals($item, $response->getItem());
5161
$this->assertEquals([$recipe1, $recipe2], $response->getGroupedRecipes());
62+
}
63+
64+
/**
65+
* Tests mapping and getting the total number of results.
66+
* @covers ::getTotalNumberOfResults
67+
* @covers ::mapResponse
68+
*/
69+
public function testGetTotalNumberOfResults()
70+
{
71+
$responseData = [
72+
'totalNumberOfResults' => 42
73+
];
74+
75+
$response = new ItemProductResponse(new TestPendingResponse($responseData));
5276
$this->assertEquals(42, $response->getTotalNumberOfResults());
5377
}
5478

tests/src/Response/Item/ItemRandomResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
class ItemRandomResponseTest extends TestCase
2121
{
2222
/**
23-
* Tests mapping and getting the authorization token.
23+
* Tests mapping and getting the items.
2424
* @covers ::getItems
2525
* @covers ::mapResponse
2626
*/
27-
public function testGetAuthorizationToken()
27+
public function testGetItems()
2828
{
2929
$responseData = [
3030
'items' => [

tests/src/Response/Recipe/RecipeDetailsResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
class RecipeDetailsResponseTest extends TestCase
2121
{
2222
/**
23-
* Tests mapping and getting the authorization token.
23+
* Tests mapping and getting the recipes.
2424
* @covers ::getRecipes
2525
* @covers ::mapResponse
2626
*/
27-
public function testGetAuthorizationToken()
27+
public function testGetRecipes()
2828
{
2929
$responseData = [
3030
'recipes' => [

0 commit comments

Comments
 (0)