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

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

public expectedDeprecated ( )
    function expectedDeprecated()
    {
        $errors = array();
        $not_caught_deprecated = array_diff($this->expected_deprecated, $this->caught_deprecated);
        foreach ($not_caught_deprecated as $not_caught) {
            $errors[] = "Failed to assert that {$not_caught} triggered a deprecated notice";
        }
        $unexpected_deprecated = array_diff($this->caught_deprecated, $this->expected_deprecated);
        foreach ($unexpected_deprecated as $unexpected) {
            $errors[] = "Unexpected deprecated notice for {$unexpected}";
        }
        $not_caught_doing_it_wrong = array_diff($this->expected_doing_it_wrong, $this->caught_doing_it_wrong);
        foreach ($not_caught_doing_it_wrong as $not_caught) {
            $errors[] = "Failed to assert that {$not_caught} triggered an incorrect usage notice";
        }
        $unexpected_doing_it_wrong = array_diff($this->caught_doing_it_wrong, $this->expected_doing_it_wrong);
        foreach ($unexpected_doing_it_wrong as $unexpected) {
            $errors[] = "Unexpected incorrect usage notice for {$unexpected}";
        }
        if (!empty($errors)) {
            $this->fail(implode("\n", $errors));
        }
    }

Usage Example

 public function expectedDeprecated()
 {
     $not_caught_deprecated_file = array_diff($this->expected_deprecated_file, $this->caught_deprecated_file);
     foreach ($not_caught_deprecated_file as $not_caught) {
         $this->fail("Failed to assert that {$not_caught} triggered a deprecated file notice");
     }
     $unexpected_deprecated_file = array_diff($this->caught_deprecated_file, $this->expected_deprecated_file);
     foreach ($unexpected_deprecated_file as $unexpected) {
         $this->fail("Unexpected deprecated file: {$unexpected}");
     }
     parent::expectedDeprecated();
 }