Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a public visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a private visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a _ prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/widgets/wpWidgetText.php

    r51493 r52010  
    3434     * @global WP_Customize_Manager $wp_customize
    3535     */
    36     function clean_up_global_scope() {
     36    public function clean_up_global_scope() {
    3737        global $wp_scripts, $wp_styles, $wp_customize;
    3838        parent::clean_up_global_scope();
     
    4747     * @covers WP_Widget_Text::__construct
    4848     */
    49     function test_construct() {
     49    public function test_construct() {
    5050        $widget = new WP_Widget_Text();
    5151        $this->assertSame( 'text', $widget->id_base );
     
    6161     * @covers WP_Widget_Text::_register
    6262     */
    63     function test__register() {
     63    public function test__register() {
    6464        set_current_screen( 'widgets.php' );
    6565        $widget = new WP_Widget_Text();
     
    7979     * @covers WP_Widget_Text::_register
    8080     */
    81     function test__register_in_customize_preview() {
     81    public function test__register_in_customize_preview() {
    8282        global $wp_customize;
    8383        wp_set_current_user(
     
    108108     * @covers WP_Widget_Text::enqueue_preview_scripts
    109109     */
    110     function test_enqueue_preview_scripts() {
     110    public function test_enqueue_preview_scripts() {
    111111        global $wp_scripts, $wp_styles;
    112112        $wp_scripts = null;
     
    130130     * @covers WP_Widget_Text::widget
    131131     */
    132     function test_widget() {
     132    public function test_widget() {
    133133        $widget = new WP_Widget_Text();
    134134        $text   = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Praesent ut turpis consequat lorem volutpat bibendum vitae vitae ante.";
     
    303303     * @return string Shortcode content.
    304304     */
    305     function do_example_shortcode() {
     305    public function do_example_shortcode() {
    306306        $this->post_during_shortcode = get_post();
    307307        $this->shortcode_render_count++;
     
    314314     * @covers WP_Widget_Text::widget
    315315     */
    316     function test_widget_shortcodes() {
     316    public function test_widget_shortcodes() {
    317317        global $post;
    318318        $post_id = $this->factory()->post->create();
     
    439439     * @return string Widget text.
    440440     */
    441     function filter_widget_text( $widget_text, $instance, $widget ) {
     441    public function filter_widget_text( $widget_text, $instance, $widget ) {
    442442        $this->widget_text_args = func_get_args();
    443443
     
    454454     * @return string Widget content.
    455455     */
    456     function filter_widget_text_content( $widget_text, $instance, $widget ) {
     456    public function filter_widget_text_content( $widget_text, $instance, $widget ) {
    457457        $this->widget_text_content_args = func_get_args();
    458458
     
    466466     * @covers WP_Widget_Text::is_legacy_instance
    467467     */
    468     function test_is_legacy_instance() {
     468    public function test_is_legacy_instance() {
    469469        $widget        = new WP_Widget_Text();
    470470        $base_instance = array(
     
    631631     * @covers WP_Widget_Text::form
    632632     */
    633     function test_form() {
     633    public function test_form() {
    634634        add_filter( 'user_can_richedit', '__return_true' );
    635635        $widget = new WP_Widget_Text();
     
    707707     * @covers WP_Widget_Text::update
    708708     */
    709     function test_update() {
     709    public function test_update() {
    710710        $widget   = new WP_Widget_Text();
    711711        $instance = array(
     
    756756     * @covers WP_Widget_Text::update
    757757     */
    758     function test_update_legacy() {
     758    public function test_update_legacy() {
    759759        $widget = new WP_Widget_Text();
    760760
     
    954954     * @return array Caps.
    955955     */
    956     function grant_unfiltered_html_cap( $caps, $cap ) {
     956    public function grant_unfiltered_html_cap( $caps, $cap ) {
    957957        if ( 'unfiltered_html' === $cap ) {
    958958            $caps   = array_diff( $caps, array( 'do_not_allow' ) );
     
    969969     * @return array Caps.
    970970     */
    971     function revoke_unfiltered_html_cap( $caps, $cap ) {
     971    public function revoke_unfiltered_html_cap( $caps, $cap ) {
    972972        if ( 'unfiltered_html' === $cap ) {
    973973            $caps   = array_diff( $caps, array( 'unfiltered_html' ) );
     
    982982     * @covers WP_Widget_Text::enqueue_admin_scripts
    983983     */
    984     function test_enqueue_admin_scripts() {
     984    public function test_enqueue_admin_scripts() {
    985985        set_current_screen( 'widgets.php' );
    986986        $widget = new WP_Widget_Text();
     
    995995     * @covers WP_Widget_Text::render_control_template_scripts
    996996     */
    997     function test_render_control_template_scripts() {
     997    public function test_render_control_template_scripts() {
    998998        ob_start();
    999999        WP_Widget_Text::render_control_template_scripts();
     
    10081008     * @ticket 46421
    10091009     */
    1010     function test_render_links_with_target() {
     1010    public function test_render_links_with_target() {
    10111011        $widget = new WP_Widget_Text();
    10121012
     
    10351035     * @ticket 46421
    10361036     */
    1037     function test_render_links_without_target() {
     1037    public function test_render_links_without_target() {
    10381038        $widget = new WP_Widget_Text();
    10391039
Note: See TracChangeset for help on using the changeset viewer.