@@ -35,7 +35,7 @@ protected function setUp(): void
3535 {
3636 $ this ->tempDir = sys_get_temp_dir () . '/yassg_test_ ' . uniqid ();
3737 mkdir ($ this ->tempDir , 0777 , true );
38-
38+
3939 $ this ->filesystem = new Filesystem ();
4040 $ this ->httpClient = $ this ->createMock (HttpClientInterface::class);
4141 $ this ->assetQueue = new AssetQueue ($ this ->tempDir , $ this ->filesystem , $ this ->httpClient );
@@ -53,44 +53,44 @@ public function testFlushReturnsAllAssetsIncludingExisting(): void
5353 // Create a temporary source file
5454 $ sourceFile = $ this ->tempDir . '/source.txt ' ;
5555 file_put_contents ($ sourceFile , 'test content ' );
56-
57- // Create existing destination file
56+
57+ // Create existing destination file
5858 $ existingDestination = '/existing/asset.txt ' ;
5959 $ existingDestinationPath = $ this ->tempDir . $ existingDestination ;
6060 $ this ->filesystem ->mkdir (dirname ($ existingDestinationPath ));
6161 file_put_contents ($ existingDestinationPath , 'existing content ' );
62-
62+
6363 // Create new destination path (doesn't exist yet)
6464 $ newDestination = '/new/asset.txt ' ;
65-
65+
6666 // Add assets to queue
6767 $ existingAsset = new AssetCopy ($ sourceFile , $ existingDestination );
6868 $ newAsset = new AssetCopy ($ sourceFile , $ newDestination );
69-
69+
7070 $ this ->assetQueue ->add ($ existingAsset );
7171 $ this ->assetQueue ->add ($ newAsset );
72-
72+
7373 // Track which assets were processed via callback
7474 $ processedAssets = [];
75-
75+
7676 // Flush the queue
7777 $ returnedAssets = $ this ->assetQueue ->flush (function ($ asset ) use (&$ processedAssets ) {
7878 $ processedAssets [] = $ asset ;
7979 });
80-
80+
8181 // Should return ALL assets (both existing and new) for incremental build support
8282 $ this ->assertCount (2 , $ returnedAssets , 'Should return all assets including existing ones ' );
8383 $ this ->assertContains ($ existingAsset , $ returnedAssets , 'Should include existing asset in return ' );
8484 $ this ->assertContains ($ newAsset , $ returnedAssets , 'Should include new asset in return ' );
85-
85+
8686 // Verify callback was only called for new asset (existing assets are skipped from processing)
8787 $ this ->assertCount (1 , $ processedAssets , 'Callback should only be called for newly processed assets ' );
8888 $ this ->assertSame ($ newAsset , $ processedAssets [0 ], 'Callback should be called with the new asset only ' );
89-
89+
9090 // Verify the new asset was actually copied
9191 $ this ->assertFileExists ($ this ->tempDir . $ newDestination , 'New asset should be copied ' );
9292 $ this ->assertEquals ('test content ' , file_get_contents ($ this ->tempDir . $ newDestination ));
93-
93+
9494 // Verify existing file was not modified
9595 $ this ->assertEquals ('existing content ' , file_get_contents ($ existingDestinationPath ));
9696 }
@@ -100,32 +100,32 @@ public function testFlushWithNoExistingAssets(): void
100100 // Create a temporary source file
101101 $ sourceFile = $ this ->tempDir . '/source.txt ' ;
102102 file_put_contents ($ sourceFile , 'test content ' );
103-
103+
104104 // Create assets that don't exist yet
105105 $ asset1 = new AssetCopy ($ sourceFile , '/new/asset1.txt ' );
106106 $ asset2 = new AssetCopy ($ sourceFile , '/new/asset2.txt ' );
107-
107+
108108 $ this ->assetQueue ->add ($ asset1 );
109109 $ this ->assetQueue ->add ($ asset2 );
110-
110+
111111 // Track which assets were processed via callback
112112 $ processedAssets = [];
113-
113+
114114 // Flush the queue
115115 $ returnedAssets = $ this ->assetQueue ->flush (function ($ asset ) use (&$ processedAssets ) {
116116 $ processedAssets [] = $ asset ;
117117 });
118-
118+
119119 // Should return all assets since none existed
120120 $ this ->assertCount (2 , $ returnedAssets , 'Should return all processed assets ' );
121121 $ this ->assertContains ($ asset1 , $ returnedAssets );
122122 $ this ->assertContains ($ asset2 , $ returnedAssets );
123-
123+
124124 // Verify callback was called for all assets
125125 $ this ->assertCount (2 , $ processedAssets , 'Callback should be called for all processed assets ' );
126126 $ this ->assertContains ($ asset1 , $ processedAssets );
127127 $ this ->assertContains ($ asset2 , $ processedAssets );
128-
128+
129129 // Verify both assets were copied
130130 $ this ->assertFileExists ($ this ->tempDir . '/new/asset1.txt ' );
131131 $ this ->assertFileExists ($ this ->tempDir . '/new/asset2.txt ' );
@@ -136,37 +136,37 @@ public function testFlushWithAllExistingAssets(): void
136136 // Create a temporary source file
137137 $ sourceFile = $ this ->tempDir . '/source.txt ' ;
138138 file_put_contents ($ sourceFile , 'test content ' );
139-
139+
140140 // Create multiple existing destination files
141141 $ existingDestinations = ['/existing1/asset.txt ' , '/existing2/asset.txt ' ];
142142 $ existingAssets = [];
143-
143+
144144 foreach ($ existingDestinations as $ destination ) {
145145 $ path = $ this ->tempDir . $ destination ;
146146 $ this ->filesystem ->mkdir (dirname ($ path ));
147147 file_put_contents ($ path , 'existing content ' );
148-
148+
149149 $ asset = new AssetCopy ($ sourceFile , $ destination );
150150 $ existingAssets [] = $ asset ;
151151 $ this ->assetQueue ->add ($ asset );
152152 }
153-
153+
154154 // Track which assets were processed via callback
155155 $ processedAssets = [];
156-
156+
157157 // Flush the queue
158158 $ returnedAssets = $ this ->assetQueue ->flush (function ($ asset ) use (&$ processedAssets ) {
159159 $ processedAssets [] = $ asset ;
160160 });
161-
161+
162162 // Should return all assets even though they all exist (for incremental build support)
163163 $ this ->assertCount (2 , $ returnedAssets , 'Should return all assets even when they all exist ' );
164164 $ this ->assertContains ($ existingAssets [0 ], $ returnedAssets );
165165 $ this ->assertContains ($ existingAssets [1 ], $ returnedAssets );
166-
166+
167167 // Verify callback was never called since no assets were actually processed
168168 $ this ->assertEmpty ($ processedAssets , 'Callback should not be called when all assets already exist ' );
169-
169+
170170 // Verify all existing files were not modified
171171 foreach ($ existingDestinations as $ destination ) {
172172 $ path = $ this ->tempDir . $ destination ;
@@ -177,7 +177,7 @@ public function testFlushWithAllExistingAssets(): void
177177 public function testEmptyQueue (): void
178178 {
179179 $ returnedAssets = $ this ->assetQueue ->flush ();
180-
180+
181181 $ this ->assertEmpty ($ returnedAssets , 'Empty queue should return empty array ' );
182182 }
183- }
183+ }
0 commit comments