HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/themes/delta/vendor/timber/timber/tests/test-timber-image-path-helper.php
<?php

	class TestTimberImagePathHelper extends TimberImage_UnitTestCase {

		function testImagePathLetterboxWithHebrew() {
			//path/to/איתין-נוף-נוסף.jpg

			$hebrew = TestTimberImage::copyTestImage('hebrew.jpg', 'איתין-נוף-נוסף.jpg');
			$upload_dir = wp_upload_dir();
			$image = $upload_dir['url'].'/איתין-נוף-נוסף.jpg';
			$new_file = TimberImageHelper::letterbox( $image, 500, 500, '#CCC', true );
			$location_of_image = TimberImageHelper::get_server_location( $new_file );
			$this->addFile( $location_of_image );
			$this->assertTrue (TestTimberImage::checkSize($location_of_image, 500, 500));
			//whats the bg/color of the image
			$this->assertTrue( TestTimberImage::checkPixel($location_of_image, 1, 1, "#CCC") );
		}

		function testImagePathStartsWithSpecialChar() {
			require_once('wp-overrides.php');
			$filename = TestTimberImage::copyTestImage('robocop.jpg', '©Robocop.jpg');
			$filesize = filesize($filename);
			$data = array('tmp_name' => $filename, 'name' => '©Robocop.jpg', 'type' => 'image/jpg', 'size' => $filesize, 'error' => 0);
			$this->assertTrue(file_exists($filename));
			$_FILES['tester'] = $data;
			$file_id = WP_Overrides::media_handle_upload('tester', 0, array(), array( 'test_form' => false));
			if (!is_int($file_id)) {
				error_log(print_r($file_id, true));
			}
			$image = new TimberImage($file_id);
			$str = '<img src="{{image.src(\'medium\')}}" />';
			$result = Timber::compile_string($str, array('image' => $image));
			$upload_dir = wp_upload_dir();
			$this->assertEquals('<img src="'.$upload_dir['url'].'/'.$image->sizes['medium']['file'].'" />', trim($result));
		}

	}