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);
            }
        }
    }
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);
            }
        }
    }
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 ) ; } } }
Check that all included ratings belong to the specified user.

@param   int                 $userid     The ID of the user being stored.
@param   \context            $context    The context being stored.
@param   array               $subcontext The subcontext path to check.
@param   string              $component  The component being stored.
@param   string              $ratingarea The rating area to store results for.
@param   int                 $itemid     The itemid to store.
Check that all included ratings belong to the specified user .