TestTimberImage::testImageResizeRelative PHP Method

testImageResizeRelative() public method

    function testImageResizeRelative()
    {
        $upload_dir = wp_upload_dir();
        self::copyTestImage();
        $url = $upload_dir['url'] . '/arch.jpg';
        $url = str_replace('http://example.org', '', $url);
        $data = array('crop' => 'default', 'test_image' => $url);
        $data['size'] = array('width' => 300, 'height' => 300);
        $html = 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);
    }