-
Bug
-
Resolution: Fixed
-
Minor
-
2.7.4, 2.8, 2.9
-
MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MDL-48685-master -
At present the useragent_test_testcase is basically written as a set of user agents in a 4-dimensional array (Browser => Version => OS => Agent), and a set of tests which then test against those.
This sucks for several reasons:
- We have one big long function which is difficult to read, and difficult to extract fail information from;
- We do not adequately test all scenarios (e.g. we do not check that Opera is not picked up as Chrome, or that IE6 is not picked up as any other browser) so we miss coverage;
- we have potential to miss tests far too easily (we can have items defined in the list of agents which have no tests against them - e.g. MSIE 5.5); and
- the information about expected false positives and obscure results can be placed in two locations depending on the test author.
We can easily fix this by rewriting this as a data provider (using the dataProvider function_name phpdoc syntax) which returns an array of useragents and expected test results.