Make WordPress Core

Ticket #26768: 26768-tests.patch

File 26768-tests.patch, 1.2 KB (added by mordauk, 11 years ago)

Adds unit tests for add_image_size(), has_image_size(), and remove_image_size()

  • tests/phpunit/tests/media.php

     
    364364                $matches = get_media_embedded_in_content( $content, $types );
    365365                $this->assertEquals( $contents, $matches );
    366366        }
     367
     368        /**
     369         * @ticket 26768
     370         */
     371        function test_add_image_size() {
     372                global $_wp_additional_image_sizes;
     373                add_image_size( 'test-size', 200, 600 );
     374                $this->assertArrayHasKey(  'test-size', $_wp_additional_image_sizes );
     375                $this->assertEquals( 200, $_wp_additional_image_sizes[ 'test-size' ]['width'] );
     376                $this->assertEquals( 600, $_wp_additional_image_sizes[ 'test-size' ]['height'] );
     377        }
     378
     379        /**
     380         * @ticket 26768
     381         */
     382        function test_remove_image_size() {
     383                add_image_size( 'test-size', 200, 600 );
     384                $this->assertTrue(  has_image_size( 'test-size' ) );
     385                remove_image_size( 'test-size' );
     386                $this->assertFalse(  has_image_size( 'test-size' ) );
     387        }
     388
     389        /**
     390         * @ticket 26951
     391         */
     392        function test_has_image_size() {
     393                add_image_size( 'test-size', 200, 600 );
     394                $this->assertTrue(  has_image_size( 'test-size' ) );
     395        }
     396
    367397}