TestTimberImage::testImageResize PHP Method

testImageResize() public method

public testImageResize ( )
    function testImageResize()
    {
        $data = array();
        $data['size'] = array('width' => 600, 'height' => 400);
        $upload_dir = wp_upload_dir();
        self::copyTestImage();
        $url = $upload_dir['url'] . '/arch.jpg';
        $data['test_image'] = $url;
        $data['crop'] = 'default';
        Timber::compile('assets/image-test.twig', $data);
        $resized_path = $upload_dir['path'] . '/arch-' . $data['size']['width'] . 'x' . $data['size']['height'] . '-c-' . $data['crop'] . '.jpg';
        $this->assertFileExists($resized_path);
        //Now make sure it doesnt regenerage
        $old_time = filemtime($resized_path);
        sleep(1);
        Timber::compile('assets/image-test.twig', $data);
        $new_time = filemtime($resized_path);
        $this->assertEquals($old_time, $new_time);
    }