|
21 | 21 | class ItemIngredientResponseTest extends TestCase |
22 | 22 | { |
23 | 23 | /** |
24 | | - * Tests mapping and getting the authorization token. |
| 24 | + * Tests mapping and getting the item. |
25 | 25 | * @covers ::getItem |
26 | | - * @covers ::getGroupedRecipes |
27 | | - * @covers ::getTotalNumberOfResults |
28 | 26 | * @covers ::mapResponse |
29 | 27 | */ |
30 | | - public function testGetAuthorizationToken() |
| 28 | + public function testGetItem() |
31 | 29 | { |
32 | 30 | $responseData = [ |
33 | 31 | 'item' => [ |
34 | 32 | '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 = [ |
36 | 50 | 'groupedRecipes' => [ |
37 | 51 | ['name' => 'def'], |
38 | 52 | ['name' => 'ghi'] |
39 | 53 | ], |
40 | | - 'totalNumberOfResults' => 42 |
41 | 54 | ]; |
42 | | - $item = new Item(); |
43 | | - $item->setName('abc'); |
44 | 55 | $recipe1 = new GenericEntityWithRecipes(); |
45 | 56 | $recipe1->setName('def'); |
46 | 57 | $recipe2 = new GenericEntityWithRecipes(); |
47 | 58 | $recipe2->setName('ghi'); |
48 | 59 |
|
49 | 60 | $response = new ItemIngredientResponse(new TestPendingResponse($responseData)); |
50 | | - $this->assertEquals($item, $response->getItem()); |
51 | 61 | $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)); |
52 | 76 | $this->assertEquals(42, $response->getTotalNumberOfResults()); |
53 | 77 | } |
54 | 78 |
|
|
0 commit comments