Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (5 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/mail.php

    r51568 r52010  
    55 */
    66class Tests_Mail extends WP_UnitTestCase {
    7         function set_up() {
     7        public function set_up() {
    88                parent::set_up();
    99                reset_phpmailer_instance();
    1010        }
    1111
    12         function tear_down() {
     12        public function tear_down() {
    1313                reset_phpmailer_instance();
    1414                parent::tear_down();
     
    2323         * back to 8bit in `MockPHPMailer::preSend`.
    2424         */
    25         function test_wp_mail_break_it() {
     25        public function test_wp_mail_break_it() {
    2626                $content = str_repeat( 'A', 1000 );
    2727                $this->assertTrue( wp_mail( WP_TESTS_EMAIL, 'Looong line testing', $content ) );
    2828        }
    2929
    30         function test_wp_mail_custom_boundaries() {
     30        public function test_wp_mail_custom_boundaries() {
    3131                $to       = 'user@example.com';
    3232                $subject  = 'Test email with custom boundaries';
     
    8989         * @ticket 17305
    9090         */
    91         function test_wp_mail_rfc2822_addresses() {
     91        public function test_wp_mail_rfc2822_addresses() {
    9292                $to        = 'Name <address@tld.com>';
    9393                $from      = 'Another Name <another_address@different-tld.com>';
     
    119119         * @ticket 17305
    120120         */
    121         function test_wp_mail_multiple_rfc2822_to_addresses() {
     121        public function test_wp_mail_multiple_rfc2822_to_addresses() {
    122122                $to      = 'Name <address@tld.com>, Another Name <another_address@different-tld.com>';
    123123                $subject = 'RFC2822 Testing';
     
    136136        }
    137137
    138         function test_wp_mail_multiple_to_addresses() {
     138        public function test_wp_mail_multiple_to_addresses() {
    139139                $to      = 'address@tld.com, another_address@different-tld.com';
    140140                $subject = 'RFC2822 Testing';
     
    152152         * @ticket 18463
    153153         */
    154         function test_wp_mail_to_address_no_name() {
     154        public function test_wp_mail_to_address_no_name() {
    155155                $to      = '<address@tld.com>';
    156156                $subject = 'RFC2822 Testing';
     
    167167         * @ticket 23642
    168168         */
    169         function test_wp_mail_return_value() {
     169        public function test_wp_mail_return_value() {
    170170                // No errors.
    171171                $this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body' ) );
     
    290290        }
    291291
    292         function wp_mail_quoted_printable( $mailer ) {
     292        public function wp_mail_quoted_printable( $mailer ) {
    293293                $mailer->Encoding = 'quoted-printable';
    294294        }
    295295
    296         function wp_mail_set_text_message( $mailer ) {
     296        public function wp_mail_set_text_message( $mailer ) {
    297297                $mailer->AltBody = 'Wörld';
    298298        }
     
    310310         * @ticket 28039
    311311         */
    312         function test_wp_mail_content_transfer_encoding_in_quoted_printable_multipart() {
     312        public function test_wp_mail_content_transfer_encoding_in_quoted_printable_multipart() {
    313313                add_action( 'phpmailer_init', array( $this, 'wp_mail_quoted_printable' ) );
    314314                add_action( 'phpmailer_init', array( $this, 'wp_mail_set_text_message' ) );
     
    412412         * @ticket 50720
    413413         */
    414         function test_phpmailer_validator() {
     414        public function test_phpmailer_validator() {
    415415                $phpmailer = $GLOBALS['phpmailer'];
    416416                $this->assertTrue( $phpmailer->validateAddress( 'foo@192.168.1.1' ), 'Assert PHPMailer accepts IP address email addresses' );
Note: See TracChangeset for help on using the changeset viewer.