public static function setup_real_writer_instance() {
        if (!PHPUNIT_TEST) {
            throw new coding_exception('setup_real_writer_instance() is only for use with PHPUnit tests.');
        }

        $instance = static::instance();

        if (null === $instance->realwriter) {
            $instance->realwriter = new moodle_content_writer(static::instance());
        }
    }