MDL-46997 Grades: Improve the behat tests for grade aggregation

The tests now cover hidden grades in sub categories for all aggregation types. This change
includes a data generator for grade categories, with unit tests and behat tests for
the generator.
MDL-46997 Grades: Fix aggregation when hiding is excluded and items have nested dependencies

Includes a unit test for the dependency flattening function.
MDL-46997 Grades: fix sum of grades with hidden items with differing maxgrades