Codeception\TestCase\WPAjaxTestCase::setUp PHP Method

setUp() public method

Override wp_die(), pretend to be ajax, and suppres E_WARNINGs
public setUp ( )
    public function setUp()
    {
        parent::setUp();
        add_filter('wp_die_ajax_handler', array($this, 'getDieHandler'), 1, 1);
        set_current_screen('ajax');
        // Clear logout cookies
        add_action('clear_auth_cookie', array($this, 'logout'));
        // Suppress warnings from "Cannot modify header information - headers already sent by"
        $this->_error_level = error_reporting();
        error_reporting($this->_error_level & ~E_WARNING);
        // Make some posts
        self::factory()->post->create_many(5);
    }