WordPress.org

Make WordPress Core

Ticket #39308: 39308.diff

File 39308.diff, 1.0 KB (added by swissspidy, 5 years ago)
  • src/wp-includes/class-wp-taxonomy.php

    diff --git src/wp-includes/class-wp-taxonomy.php src/wp-includes/class-wp-taxonomy.php
    index 4611ce9744..3a69b76551 100644
    final class WP_Taxonomy { 
    333333                        }
    334334                }
    335335
     336                $args['name'] = $this->name;
     337
    336338                foreach ( $args as $property_name => $property_value ) {
    337339                        $this->$property_name = $property_value;
    338340                }
  • tests/phpunit/tests/taxonomy.php

    diff --git tests/phpunit/tests/taxonomy.php tests/phpunit/tests/taxonomy.php
    index ca317bb395..9a4e8b2a0f 100644
    class Tests_Taxonomy extends WP_UnitTestCase { 
    710710                $this->assertFalse( taxonomy_exists( 'foo' ) );
    711711        }
    712712
     713        /**
     714         * @ticket 39308
     715         */
     716        public function test_taxonomy_name_property_should_not_get_overridden_by_passed_args() {
     717                register_taxonomy( 'foo', 'post', array( 'name' => 'bar' ) );
     718
     719                $taxonomy = get_taxonomy( 'foo' );
     720                unregister_taxonomy( 'foo' );
     721
     722                $this->assertSame( 'foo', $taxonomy->name );
     723        }
    713724}