Make WordPress Core

Changeset 825 in tests


Ignore:
Timestamp:
06/30/2012 10:23:51 PM (12 years ago)
Author:
nacin
Message:

Port test_image.php. fixes #61.

As these are the only instances of the old WPTestCase::checkPHPExtension() helper, I've passed on re-implementing it in WP_UnitTestCase.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-testcase/test_image.php

    r685 r825  
    11<?php
    22
    3 class TestImageMetaFunctions extends WPTestCase {
     3class TestImageMetaFunctions extends WP_UnitTestCase {
    44    function setUp() {
    5         $this->checkPHPExtension('gd');
    6         $this->checkPHPExtension('exif');
    7         if (!is_callable('wp_read_image_metadata'))
    8             $this->markTestSkipped('wp_read_image_metadata() is not callable.');
     5        if ( ! extension_loaded( 'gd' ) )
     6            $this->markTestSkipped( 'The gd PHP extension is not loaded.' );
     7        if ( ! extension_loaded( 'exif' ) )
     8            $this->markTestSkipped( 'The exif PHP extension is not loaded.' );
     9        if ( ! is_callable( 'wp_read_image_metadata' ) )
     10            $this->markTestSkipped( 'wp_read_image_metadata() is not callable.' );
    911        parent::setUp();
    1012    }
     
    130132}
    131133
    132 class TestImageSizeFunctions extends WpTestCase {
     134class TestImageSizeFunctions extends WP_UnitTestCase {
    133135    function test_constrain_dims_zero() {
    134136        if (!is_callable('wp_constrain_dimensions'))
     
    322324}
    323325
    324 class TestImageResizeDimensions extends WPTestCase {
     326class TestImageResizeDimensions extends WP_UnitTestCase {
    325327    function test_400x400_no_crop() {
    326328        // landscape: resize 640x480 to fit 400x400: 400x300
     
    447449}
    448450
    449 class TestImageResize extends WPTestCase {
     451class TestImageResize extends WP_UnitTestCase {
    450452    // image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=75)
    451453
    452454    function setUp() {
    453         $this->checkPHPExtension('gd');
     455        if ( ! extension_loaded( 'gd' ) )
     456            $this->markTestSkipped( 'The gd PHP extension is not loaded.' );
    454457        parent::setUp();
    455458    }
     
    566569}
    567570
    568 class TestIsImageFunctions extends WPTestCase {
     571class TestIsImageFunctions extends WP_UnitTestCase {
    569572    function test_is_image_positive() {
    570573        // these are all image files recognized by php
Note: See TracChangeset for help on using the changeset viewer.