Make WordPress Core

Ticket #28121: 28121.tests.diff

File 28121.tests.diff, 2.3 KB (added by iandunn, 12 years ago)
  • tests/phpunit/includes/testcase.php

     
    160160                $this->assertEquals( array(), array_diff( $actual, $expected ) );
    161161        }
    162162
     163        /**
     164         * Asserts that the given variable is a multidimensional array, and that all arrays are non-empty.
     165         *
     166         * @param array $array
     167         */
     168        function assertNonEmptyMultidimensionalArray( $array ) {
     169                $this->assertTrue( is_array( $array ) );
     170                $this->assertNotEmpty( $array );
     171
     172                foreach( $array as $sub_array ) {
     173                        $this->assertTrue( is_array( $sub_array ) );
     174                        $this->assertNotEmpty( $sub_array );
     175                }
     176        }
     177
    163178        function go_to( $url ) {
    164179                // note: the WP and WP_Query classes like to silently fetch parameters
    165180                // from all over the place (globals, GET, etc), which makes it tricky
  • tests/phpunit/tests/admin/includesTheme.php

     
    6565                $this->assertEquals( "subdir/template-sub-dir.php", $templates['Sub Dir'] );
    6666                $this->assertEquals( "template-header.php", $templates['This Template Header Is On One Line'] );
    6767        }
     68
     69        /**
     70         * Test that The list of theme features pulled from the WordPress.org API returns the expected data structure.
     71         *
     72         * Differences in the structure can also trigger failure by causing PHP notices/warnings.
     73         *
     74         * @ticket 28121
     75         */
     76        function test_get_theme_featured_list_api() {
     77                wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     78                $featured_list_api = get_theme_feature_list( true );
     79                $this->assertNonEmptyMultidimensionalArray( $featured_list_api );
     80        }
     81
     82        /**
     83         * Test that The list of theme features hardcoded into Core returns the expected data structure
     84         *
     85         * Differences in the structure can also trigger failure by causing PHP notices/warnings.
     86         *
     87         * @ticket 28121
     88         */
     89        function test_get_theme_featured_list_hardcoded() {
     90                $featured_list_hardcoded = get_theme_feature_list( false );
     91                $this->assertNonEmptyMultidimensionalArray( $featured_list_hardcoded );
     92        }
    6893}