TestTimberImage::testPostThumbnailsNamed PHP Method

testPostThumbnailsNamed() public method

    function testPostThumbnailsNamed()
    {
        add_image_size('timber-testPostThumbnailsNamed', $width = 100, $height = 50, $crop = true);
        $upload_dir = wp_upload_dir();
        $post_id = $this->factory->post->create();
        $filename = self::copyTestImage('flag.png');
        $destination_url = str_replace(ABSPATH, 'http://' . $_SERVER['HTTP_HOST'] . '/', $filename);
        $wp_filetype = wp_check_filetype(basename($filename), null);
        $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', basename($filename)), 'post_content' => '', 'post_status' => 'inherit');
        $attach_id = wp_insert_attachment($attachment, $filename, $post_id);
        add_post_meta($post_id, '_thumbnail_id', $attach_id, true);
        $data = array();
        $data['post'] = new TimberPost($post_id);
        $data['size'] = 'timber-testPostThumbnailsNamed';
        Timber::compile('assets/image-thumb-named.twig', $data);
        $resized_path = $upload_dir['path'] . '/flag-' . $width . 'x' . $height . '-c-default.png';
        $this->assertFileExists($resized_path);
    }