Make WordPress Core


Ignore:
Timestamp:
02/27/2018 02:30:46 AM (9 years ago)
Author:
SergeyBiryukov
Message:

General: Introduce WP_Error::has_errors() method and use it where appropriate.

Props robdxw, DrewAPicture, SergeyBiryukov.
Fixes #42742.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/general/wpError.php

    r42646 r42761  
    377377
    378378        /**
     379         * @covers ::has_errors()
     380         */
     381        public function test_has_errors_with_no_errors_returns_false() {
     382                $this->assertFalse( $this->WP_Error->has_errors() );
     383        }
     384
     385        /**
     386         * @covers ::has_errors()
     387         */
     388        public function test_has_errors_with_errors_returns_true() {
     389                $this->WP_Error->add( 'code', 'message', 'data' );
     390                $this->assertTrue( $this->WP_Error->has_errors() );
     391        }
     392
     393        /**
    379394         * @covers ::add()
    380395         */
Note: See TracChangeset for help on using the changeset viewer.