Skip to content

Commit 726da41

Browse files
Fix unit tests
1 parent 03fefe8 commit 726da41

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/class-tiny-picture.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private function replace_picture( $content, $source ) {
142142
* Will replace img elements with picture elements that (possibly) have additional formats.
143143
*
144144
* @param string $content the full page content
145-
* @param Tiny_Image_Source $source the picture element
145+
* @param Tiny_Source_Image $source the picture element
146146
*
147147
* @return string the updated content including augmented picture elements
148148
*/

test/unit/TinyPictureTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ public function test_get_largest_width_descriptor_returns_largest_value()
178178
array('path' => 'c', 'size' => '2x'), // this is effectively ignored because there are width descriptors
179179
);
180180

181-
$imgSource = new Tiny_Image_Source('<img srcset="/wp-content/uploads/2025/01/test-420w.jpg 420w, /wp-content/uploads/2025/01/test-650w.jpg 650w, /wp-content/uploads/2025/01/test.jpg 2000w" src="/wp-content/uploads/2025/01/test.jpg" />', '', array());
182-
$largest = Tiny_Image_Source::get_largest_width_descriptor($srcsets);
181+
$largest = Tiny_Source_Image::get_largest_width_descriptor($srcsets);
183182

184183
$this->assertEquals(2000, $largest);
185184
}
@@ -191,7 +190,7 @@ public function test_get_largest_width_descriptor_without_widths_returns_zero()
191190
array('path' => '/wp-content/uploads/2025/01/test.jpg', 'size' => '2x'),
192191
);
193192

194-
$largest = Tiny_Image_Source::get_largest_width_descriptor($srcsets);
193+
$largest = Tiny_Source_Image::get_largest_width_descriptor($srcsets);
195194

196195
$this->assertSame(0, $largest);
197196
}
@@ -203,7 +202,7 @@ public function test_srcset_contains_width_descriptor_returns_true_when_present(
203202
'/wp-content/uploads/2025/01/test-640w.webp 640w',
204203
);
205204

206-
$this->assertTrue(Tiny_Image_Source::srcset_contains_width_descriptor($parts, 640));
205+
$this->assertTrue(Tiny_Source_Image::srcset_contains_width_descriptor($parts, 640));
207206
}
208207

209208
public function test_srcset_contains_width_descriptor_returns_false_when_missing()
@@ -213,7 +212,7 @@ public function test_srcset_contains_width_descriptor_returns_false_when_missing
213212
'/wp-content/uploads/2025/01/test-640w.webp 640w',
214213
);
215214

216-
$this->assertFalse(Tiny_Image_Source::srcset_contains_width_descriptor($parts, 1280));
215+
$this->assertFalse(Tiny_Source_Image::srcset_contains_width_descriptor($parts, 1280));
217216
}
218217

219218
public function test_get_largest_width_no_descriptors()
@@ -222,7 +221,7 @@ public function test_get_largest_width_no_descriptors()
222221
array('path' => '/wp-content/uploads/2025/01/test.jpg', 'size' => ''),
223222
);
224223

225-
$largest = Tiny_Image_Source::get_largest_width_descriptor($srcsets);
224+
$largest = Tiny_Source_Image::get_largest_width_descriptor($srcsets);
226225

227226
$this->assertSame(0, $largest);
228227
}

0 commit comments

Comments
 (0)