@@ -46,21 +46,21 @@ protected function tearDown(): void
4646 public function testStorageNewGetPieceImageWithThemeUrls ()
4747 {
4848 $ config = $ this ->createConfigWithThemeUrls ();
49- $ storage = $ this ->createStorageNew ();
49+ $ storage = $ this ->createStorageNew ($ config );
5050 $ piece = new Pawn ('white ' );
5151 $ piece ->setRow (1 )->setColumn (0 );
5252
5353 // Storage should use theme URLs
5454 // It will fail when trying to download/load the image, but that's expected
5555 $ this ->expectException (\Intervention \Image \Exception \NotReadableException::class);
5656
57- $ storage ->getPieceImage ($ piece, $ config );
57+ $ storage ->getPieceImage ($ piece );
5858 }
5959
6060 public function testStorageNewGetPieceImageThrowsExceptionWhenPieceUrlMissing ()
6161 {
6262 $ config = $ this ->createConfigWithPartialThemeUrls ();
63- $ storage = $ this ->createStorageNew ();
63+ $ storage = $ this ->createStorageNew ($ config );
6464
6565 // Create a piece that doesn't have a URL in themeUrls
6666 $ pieceWithoutUrl = new \DiagramGenerator \Fen \King ('white ' );
@@ -70,7 +70,7 @@ public function testStorageNewGetPieceImageThrowsExceptionWhenPieceUrlMissing()
7070 $ this ->expectException (\RuntimeException::class);
7171 $ this ->expectExceptionMessage ('Piece URL not found in theme for piece: wk ' );
7272
73- $ storage ->getPieceImage ($ pieceWithoutUrl, $ config );
73+ $ storage ->getPieceImage ($ pieceWithoutUrl );
7474 }
7575
7676 public function testStorageGetPieceImage ()
@@ -96,24 +96,24 @@ public function testStorageGetPieceImage()
9696 public function testStorageNewGetBackgroundTextureImageWithThemeUrls ()
9797 {
9898 $ config = $ this ->createConfigWithThemeUrls ();
99- $ storage = $ this ->createStorageNew ();
99+ $ storage = $ this ->createStorageNew ($ config );
100100
101101 // Should try to load from theme URLs
102102 // It will fail when trying to download/load the image, but that's expected
103103 $ this ->expectException (\Intervention \Image \Exception \NotReadableException::class);
104104
105- $ storage ->getBackgroundTextureImage ($ config );
105+ $ storage ->getBackgroundTextureImage ();
106106 }
107107
108108 public function testStorageNewGetBackgroundTextureImageReturnsNullWhenBoardUrlMissing ()
109109 {
110110 $ config = $ this ->createConfigWithPartialThemeUrls ();
111111 // Remove board URL
112112 $ config ->setThemeUrls (['wp ' => 'https://example.com/wp.png ' ]);
113- $ storage = $ this ->createStorageNew ();
113+ $ storage = $ this ->createStorageNew ($ config );
114114
115115 // Should return null when board URL is not in themeUrls
116- $ result = $ storage ->getBackgroundTextureImage ($ config );
116+ $ result = $ storage ->getBackgroundTextureImage ();
117117 $ this ->assertNull ($ result );
118118 }
119119
@@ -129,7 +129,8 @@ public function testStorageGetBackgroundTextureImageReturnsNullWhenNoTexture()
129129
130130 public function testGetCachedPieceFilePathFromTheme ()
131131 {
132- $ storage = $ this ->createStorageNew ();
132+ $ config = $ this ->createConfigWithThemeUrls ();
133+ $ storage = $ this ->createStorageNew ($ config );
133134 $ pieceUrl = 'https://example.com/pieces/wp.png ' ;
134135 $ piece = 'wp ' ;
135136
@@ -152,7 +153,8 @@ public function testGetCachedPieceFilePathFromTheme()
152153
153154 public function testGetCachedPieceFilePathFromThemeWithCustomExtension ()
154155 {
155- $ storage = $ this ->createStorageNew ();
156+ $ config = $ this ->createConfigWithThemeUrls ();
157+ $ storage = $ this ->createStorageNew ($ config );
156158 $ pieceUrl = 'https://example.com/pieces/wp.jpg ' ;
157159 $ piece = 'wp ' ;
158160
@@ -175,7 +177,8 @@ public function testGetCachedPieceFilePathFromThemeWithCustomExtension()
175177
176178 public function testGetCachedTextureFilePathFromTheme ()
177179 {
178- $ storage = $ this ->createStorageNew ();
180+ $ config = $ this ->createConfigWithThemeUrls ();
181+ $ storage = $ this ->createStorageNew ($ config );
179182 $ boardUrl = 'https://example.com/boards/board.png ' ;
180183
181184 $ reflection = new \ReflectionClass ($ storage );
@@ -196,7 +199,8 @@ public function testGetCachedTextureFilePathFromTheme()
196199
197200 public function testGetCachedTextureFilePathFromThemeWithCustomExtension ()
198201 {
199- $ storage = $ this ->createStorageNew ();
202+ $ config = $ this ->createConfigWithThemeUrls ();
203+ $ storage = $ this ->createStorageNew ($ config );
200204 $ boardUrl = 'https://example.com/boards/board.jpg ' ;
201205
202206 $ reflection = new \ReflectionClass ($ storage );
@@ -220,9 +224,9 @@ protected function createStorage()
220224 return new Storage ($ this ->cacheDirectory , $ this ->pieceThemeUrl , $ this ->boardTextureUrl );
221225 }
222226
223- protected function createStorageNew ()
227+ protected function createStorageNew (Config $ config )
224228 {
225- return new StorageNew ($ this ->cacheDirectory , $ this -> pieceThemeUrl , $ this -> boardTextureUrl );
229+ return new StorageNew ($ this ->cacheDirectory , $ config );
226230 }
227231
228232 protected function createConfigWithThemeUrls ()
0 commit comments