Make WordPress Core


Ignore:
Timestamp:
03/26/2019 12:45:57 AM (5 years ago)
Author:
johnbillion
Message:

Build/Test tools: Fix the Travis CI build for the 4.0 branch.

Among other fixes, this backports [29860], [29869], [29954], [30160], [30530].

Fixes #46646

Location:
branches/4.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/tests/phpunit/tests/taxonomy.php

    r28926 r45013  
    3434    }
    3535
    36     function test_get_the_taxonomies() {
    37         $post_id = $this->factory->post->create();
    38 
    39         $taxes = get_the_taxonomies( $post_id );
    40         $this->assertNotEmpty( $taxes );
    41         $this->assertEquals( array( 'category' ), array_keys( $taxes ) );
    42 
    43         $id = $this->factory->tag->create();
    44         wp_set_post_tags( $post_id, array( $id ) );
    45 
    46         $taxes = get_the_taxonomies( $post_id );
    47         $this->assertNotEmpty( $taxes );
    48         $this->assertCount( 2, $taxes );
    49         $this->assertEquals( array( 'category', 'post_tag' ), array_keys( $taxes ) );
    50     }
    51 
    5236    function test_the_taxonomies() {
    5337        $post_id = $this->factory->post->create();
     
    135119    }
    136120
    137     /**
    138      * @ticket 11058
    139      */
    140     function test_registering_taxonomies_to_object_types() {
    141         // Create a taxonomy to test with
    142         $tax = 'test_tax';
    143         $this->assertFalse( taxonomy_exists($tax) );
    144         register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
    145 
    146         // Create a post type to test with
    147         $post_type = 'test_cpt';
    148         $this->assertFalse( get_post_type( $post_type ) );
    149         $this->assertObjectHasAttribute( 'name', register_post_type( $post_type ) );
    150 
    151         // Core taxonomy, core post type
    152         $this->assertTrue( unregister_taxonomy_for_object_type( 'category', 'post' ) );
    153         $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'post' ) );
    154         $this->assertTrue( register_taxonomy_for_object_type( 'category', 'post' ) );
    155 
    156         // Core taxonomy, non-core post type
    157         $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
    158         $this->assertTrue( unregister_taxonomy_for_object_type( 'category', $post_type ) );
    159         $this->assertFalse( unregister_taxonomy_for_object_type( 'category', $post_type ) );
    160         $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
    161 
    162         // Core taxonomies, non-post object types
    163         $this->assertFalse( register_taxonomy_for_object_type( 'category', 'user' ) );
    164         $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'user' ) );
    165 
    166         // Non-core taxonomy, core post type
    167         $this->assertTrue( unregister_taxonomy_for_object_type( $tax, 'post' ) );
    168         $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'post' ) );
    169         $this->assertTrue( register_taxonomy_for_object_type( $tax, 'post' ) );
    170 
    171         // Non-core taxonomy, non-core post type
    172         $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
    173         $this->assertTrue( unregister_taxonomy_for_object_type( $tax, $post_type ) );
    174         $this->assertFalse( unregister_taxonomy_for_object_type( $tax, $post_type ) );
    175         $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
    176 
    177         // Non-core taxonomies, non-post object types
    178         $this->assertFalse( register_taxonomy_for_object_type( $tax, 'user' ) );
    179         $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'user' ) );
    180 
    181         unset($GLOBALS['wp_taxonomies'][$tax]);
    182         _unregister_post_type( $post_type );
    183 
    184     }
    185121    /**
    186122     * @ticket 25706
Note: See TracChangeset for help on using the changeset viewer.