WordPress.org

Make WordPress Core

Ticket #31362: unexpected-deprecated-demo.diff

File unexpected-deprecated-demo.diff, 798 bytes (added by jdgrimes, 5 years ago)

Demonstrates the issues bing reported

  • tests/phpunit/tests/includes/helpers.php

     
    185185                $this->mock_incorrect_usage();
    186186        }
    187187
     188        public function test_is_true_on_occasion() {
     189                add_filter( __CLASS__, '__return_true' );
     190                $this->mock_deprecated();
     191                $this->assertTrue( apply_filters( __CLASS__, true ) );
     192        }
     193
     194        public function test_is_false_by_default() {
     195                $this->assertFalse( apply_filters( __CLASS__, false ) );
     196        }
     197
     198        public function test_both_reported() {
     199                $this->mock_deprecated();
     200                $this->mock_incorrect_usage();
     201        }
     202
    188203        protected function mock_deprecated() {
    189204                _deprecated_function( __METHOD__, '2.5' );
    190205        }