protected function assert_all_own_ratings_on_context(
        int $userid,
        \context $context,
        array $subcontext,
        $component,
        $ratingarea,
        $itemid
    ) {
        $writer = \core_privacy\local\request\writer::with_context($context);
        $rm = new \rating_manager();
        $dbratings = $rm->get_all_ratings_for_item((object) [
            'context' => $context,
            'component' => $component,
            'ratingarea' => $ratingarea,
            'itemid' => $itemid,
        ]);

        $exportedratings = $this->get_ratings_on_subcontext($context, $subcontext);

        foreach ($exportedratings as $ratingid => $rating) {
            $this->assertTrue(isset($dbratings[$ratingid]));
            $this->assertEquals($userid, $rating->author);
            $this->assert_rating_matches($dbratings[$ratingid], $rating);
        }

        foreach ($dbratings as $rating) {
            if ($rating->userid == $userid) {
                $this->assertEquals($rating->id, $ratingid);
            }
        }
    }