TestTimberImage::copyTestImage PHP Method

copyTestImage() static public method

static public copyTestImage ( $img = 'arch.jpg', $dest_name = null )
    static function copyTestImage($img = 'arch.jpg', $dest_name = null)
    {
        $upload_dir = wp_upload_dir();
        if (is_null($dest_name)) {
            $dest_name = $img;
        }
        $destination = $upload_dir['path'] . '/' . $dest_name;
        copy(__DIR__ . '/assets/' . $img, $destination);
        return $destination;
    }

Usage Example

 function testCropHeight()
 {
     $arch = TestTimberImage::copyTestImage('arch.jpg');
     $resized = TimberImageHelper::resize($arch, false, 250);
     $resized = str_replace('http://example.org', '', $resized);
     $resized = TimberUrlHelper::url_to_file_system($resized);
     $is_sized = TestTimberImage::checkSize($resized, 375, 250);
     $this->assertTrue($is_sized);
 }
All Usage Examples Of TestTimberImage::copyTestImage