public function testMatrixCalculation(float
$expectedScore, int
$reviewCounts, float
$total, array
$aggregation): void
{ $matrix =
new RatingMatrix($aggregation);
$expectedScore =
round($expectedScore, 4
);
$actual =
round($matrix->
getAverageRating(), 4
);
static::
assertEquals($expectedScore,
$actual, 'expected score does not match'
);
static::
assertEquals($reviewCounts,
$matrix->
getTotalReviewCount(), 'expected total review count does not match'
);
static::
assertEquals($total,
$matrix->
getPointSum(), 'expected total review points does not match'
);
} /**
* dataprovider for testMatrixCalculation
*/
public static function getRatings(): array
{ return [ 'all one, rating should be 3, review count 5 and total points 15' =>
[ 3.0, 5, 15, self::
getDatabaseMatrixAggregationArray(1, 1, 1, 1, 1
),
],