Make WordPress Core

Ticket #36054: test_functions_35987.diff

File test_functions_35987.diff, 1.5 KB (added by borgesbruno, 9 years ago)

Fix typo

  • tests/phpunit/tests/functions.php

     
    717717                the_date( 'Y', 'before ', ' after', false );
    718718                $this->assertEquals( '', ob_get_clean() );
    719719        }
     720
     721        /**
     722         * @ticket 35987
     723         */
     724        function test_wp_get_ext_types() {
     725                $extensionList = wp_get_ext_types();
     726
     727                $this->assertInternalType( 'array', $extensionList);
     728                $this->assertNotEmpty($extensionList);
     729
     730                add_filter( 'ext_types', '__return_empty_array' );
     731                $mimes = wp_get_ext_types();
     732                $this->assertInternalType( 'array', $mimes );
     733                $this->assertEmpty( $mimes );
     734
     735                remove_filter( 'ext_types', '__return_empty_array' );
     736                $mimes = wp_get_ext_types();
     737                $this->assertInternalType( 'array', $mimes );
     738                $this->assertNotEmpty( $mimes );
     739
     740                $this->assertTrue(in_array('jpg', $extensionList['image']));
     741                $this->assertTrue(in_array('php', $extensionList['code']));
     742                $this->assertTrue(in_array('xls', $extensionList['spreadsheet']));
     743        }
     744
     745        /**
     746         * @ticket 35987
     747         */
     748        function test_wp_ext2type() {
     749                $extensions = wp_get_ext_types();
     750
     751                foreach ($extensions as $type => $extension) {
     752                        #Using just the first extension in array file for testing to don't decrease the test performance
     753                        $this->assertEquals($type, wp_ext2type($extension[0]));
     754                        $this->assertEquals($type, wp_ext2type(strtoupper($extension[0])));
     755                }
     756                $this->assertNull(wp_ext2type('unknown_format'));
     757        }
    720758}