Codeception\TestCase\WPTestCase::expectDeprecated PHP Метод

expectDeprecated() публичный Метод

public expectDeprecated ( )
    function expectDeprecated()
    {
        $annotations = $this->getAnnotations();
        foreach (array('class', 'method') as $depth) {
            if (!empty($annotations[$depth]['expectedDeprecated'])) {
                $this->expected_deprecated = array_merge($this->expected_deprecated, $annotations[$depth]['expectedDeprecated']);
            }
            if (!empty($annotations[$depth]['expectedIncorrectUsage'])) {
                $this->expected_doing_it_wrong = array_merge($this->expected_doing_it_wrong, $annotations[$depth]['expectedIncorrectUsage']);
            }
        }
        add_action('deprecated_function_run', array($this, 'deprecated_function_run'));
        add_action('deprecated_argument_run', array($this, 'deprecated_function_run'));
        add_action('doing_it_wrong_run', array($this, 'doing_it_wrong_run'));
        add_action('deprecated_function_trigger_error', '__return_false');
        add_action('deprecated_argument_trigger_error', '__return_false');
        add_action('doing_it_wrong_trigger_error', '__return_false');
    }

Usage Example

 public function expectDeprecated()
 {
     parent::expectDeprecated();
     add_action('deprecated_file_included', array($this, 'deprecated_file_run'));
     add_action('deprecated_file_trigger_error', '__return_false');
 }