Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-48685

Rework useragent tests to improve coverage

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.4, 2.8, 2.9
    • 2.7.5, 2.8.3
    • Unit tests

    Description

      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:

      1. We have one big long function which is difficult to read, and difficult to extract fail information from;
      2. 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;
      3. 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
      4. 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.

      Attachments

        Activity

          People

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Rajesh Taneja Rajesh Taneja
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Zachary Durber Zachary Durber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              2/Feb/15