@@ -113,33 +113,47 @@ function testCropHeight() {
113113 $ this ->assertTrue ( $ is_sized );
114114 }
115115
116- function testWPMLurls () {
116+ function testWPMLurlRemote () {
117117 // this test replicates the url issue caused by the WPML language identifier in the url
118118 // However, WPML can't be installed with composer so this test mocks the WPML plugin
119119
120120 // WPML uses a filter to alter the home_url
121121 $ home_url_filter = function ( $ url ) { return $ url .'/en ' ; };
122122 add_filter ( 'home_url ' , $ home_url_filter , -10 , 4 );
123123
124+ $ img = 'https://raw.githubusercontent.com/timber/timber/master/tests/assets/arch-2night.jpg ' ;
124125 // test with a local and external file
125- foreach ( array (
126- 'arch.jpg ' ,
127- 'https://raw.githubusercontent.com/timber/timber/master/tests/assets/arch-2night.jpg '
128- ) as $ img ) {
129-
130- // copy image if it's local
131- if ( strpos ($ img , ':// ' ) === false ) {
132- $ img = TestTimberImage::copyTestImage ($ img );
133- }
134-
135- $ resized = TimberImageHelper::resize ($ img , 50 , 50 );
136-
137- // make sure the base url has not been duplicated (https://github.com/timber/timber/issues/405)
138- $ this ->assertLessThanOrEqual ( 1 , substr_count ($ resized , 'example.org ' ) );
139- // make sure the image has been resized
140- $ resized = TimberUrlHelper::url_to_file_system ( $ resized );
141- $ this ->assertTrue ( TestTimberImage::checkSize ($ resized , 50 , 50 ), 'image should be resized ' );
142- }
126+
127+ $ resized = TimberImageHelper::resize ($ img , 50 , 50 );
128+
129+ // make sure the base url has not been duplicated (https://github.com/timber/timber/issues/405)
130+ $ this ->assertLessThanOrEqual ( 1 , substr_count ($ resized , 'example.org ' ) );
131+ // make sure the image has been resized
132+ $ resized = TimberUrlHelper::url_to_file_system ( $ resized );
133+ $ this ->assertTrue ( TestTimberImage::checkSize ($ resized , 50 , 50 ), 'image should be resized ' );
134+
135+ }
136+
137+ function testWPMLurlLocal () {
138+ // this test replicates the url issue caused by the WPML language identifier in the url
139+ // However, WPML can't be installed with composer so this test mocks the WPML plugin
140+
141+ // WPML uses a filter to alter the home_url
142+ $ home_url_filter = function ( $ url ) { return $ url .'/en ' ; };
143+ add_filter ( 'home_url ' , $ home_url_filter , -10 , 4 );
144+
145+ // test with a local and external file
146+ $ img = 'arch.jpg ' ;
147+ $ img = TestTimberImage::copyTestImage ($ img );
148+
149+ $ resized = TimberImageHelper::resize ($ img , 50 , 50 );
150+
151+ // make sure the base url has not been duplicated (https://github.com/timber/timber/issues/405)
152+ $ this ->assertLessThanOrEqual ( 1 , substr_count ($ resized , 'example.org ' ) );
153+ // make sure the image has been resized
154+ $ resized = TimberUrlHelper::url_to_file_system ( $ resized );
155+ $ this ->assertTrue ( TestTimberImage::checkSize ($ resized , 50 , 50 ), 'image should be resized ' );
156+
143157 }
144158
145159}
0 commit comments