@@ -44,8 +44,6 @@ final class InventoryLoaderTest extends TestCase
4444 private JsonLoader &MockObject $ jsonLoader ;
4545 private DefaultInventoryRepository $ inventoryRepository ;
4646 private RenderContext &MockObject $ renderContext ;
47- /** @var array<string, mixed> */
48- private array $ json ;
4947
5048 protected function setUp (): void
5149 {
@@ -65,9 +63,10 @@ public function loadObjectsJsonInv(string $filename): void
6563 {
6664 $ jsonString = file_get_contents ($ filename );
6765 assertIsString ($ jsonString );
68- $ this ->json = (array ) json_decode ($ jsonString , true , 512 , JSON_THROW_ON_ERROR );
66+ /** @var array<array-key, mixed> $json */
67+ $ json = (array ) json_decode ($ jsonString , true , 512 , JSON_THROW_ON_ERROR );
6968 $ inventory = new Inventory ('https://example.com/ ' , new SluggerAnchorNormalizer ());
70- $ this ->inventoryLoader ->loadInventoryFromJson ($ inventory , $ this -> json );
69+ $ this ->inventoryLoader ->loadInventoryFromJson ($ inventory , $ json );
7170 $ this ->inventoryRepository ->addInventory ('somekey ' , $ inventory );
7271 $ this ->inventoryRepository ->addInventory ('some-key ' , $ inventory );
7372 }
@@ -82,7 +81,9 @@ public function testInventoryLoaderLoadsInventory(): void
8281
8382 public function testInventoryIsLoadedExactlyOnce (): void
8483 {
85- $ this ->jsonLoader ->expects (self ::once ())->method ('loadJsonFromUrl ' )->willReturn ($ this ->json );
84+ $ this ->jsonLoader ->expects (self ::once ())->method ('loadJsonFromUrl ' )->willReturn (
85+ ['dummy ' => 'data ' , 'items ' => []]
86+ );
8687 $ inventory = new Inventory ('https://example.com/ ' , new SluggerAnchorNormalizer ());
8788 $ this ->inventoryLoader ->loadInventory ($ inventory );
8889 $ this ->inventoryLoader ->loadInventory ($ inventory );
0 commit comments