__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.148: ~ $
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * User agent test suite.
 *
 * @package    core
 * @copyright  2013 Sam Hemelryk
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @covers \core_useragent
 */
final class useragent_test extends advanced_testcase {

    /**
     * Restores the user agent to the default one.
     */
    public function tearDown(): void {
        core_useragent::instance(true);
        parent::tearDown();
    }

    /**
     * Data provider for known user agents.
     *
     * @return array
     */
    public static function user_agents_providers(): array {
        // Note: When adding new entries to this list, please ensure that any new browser versions are added to the corresponding list.
        // This ensures that regression tests are applied to all known user agents.
        return array(
            'Microsoft Edge for Windows 10 Desktop' => array(
                'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136',
                array(
                    'is_edge'                       => true,
                    'check_edge_version'            => array(
                        '12'                        => true,
                    ),

                    // Edge pretends to be WebKit.
                    'is_webkit'                     => true,

                    // Edge pretends to be Chrome.
                    // Note: Because Edge pretends to be Chrome, it will not be picked up as a Safari browser.
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                        '39'                        => true,
                    ),

                    'versionclasses'                => array(
                        'edge',
                    ),
                ),
            ),
            'Microsoft Edge for Windows 10 Mobile' => array(
                'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10136',
                array(
                    'is_edge'                       => true,
                    'check_edge_version'              => array(
                        '12'                        => true,
                    ),

                    // Edge pretends to be WebKit.
                    'is_webkit'                     => true,

                    // Mobile Edge pretends to be Android.
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    // Edge pretends to be Chrome.
                    // Note: Because Edge pretends to be Chrome, it will not be picked up as a Safari browser.
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                        '39'                        => true,
                    ),

                    'versionclasses'                => array(
                        'edge'
                    ),

                    'devicetype'                    => 'mobile',
                ),
            ),

            // Windows XP; Firefox 1.0.6.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6',
                array(
                    'is_firefox'                    => true,

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko17',
                    ),
                ),
            ),

            // Windows XP; Firefox 1.0.6.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8) Gecko/20051107 Firefox/1.5',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // Windows XP; Firefox 1.5.0.1.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // Windows XP; Firefox 2.0.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // Ubuntu Linux amd64; Firefox 2.0.
            array(
                'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1) Gecko/20060601 Firefox/2.0 (Ubuntu-edgy)',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko18',
                    ),
                ),
            ),

            // SUSE; Firefox 3.0.6.
            array(
                'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.6) Gecko/2009012700 SUSE/3.0.6-1.4 Firefox/3.0.6',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko19',
                    ),
                ),
            ),

            // Linux i686; Firefox 3.6.
            array(
                'Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/3.6',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '3.6'                       => true,
                        '20100101'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko20',
                    ),
                ),
            ),

            // Windows; Firefox 11.0.
            array(
                'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko Firefox/11.0',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Windows; Firefox 15.0a2.
            array(
                'Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                        '15'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                        '15.0'                      => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Firefox 18; Mac OS X 10.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:18.0) Gecko/18.0 Firefox/18.0',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                        '15'                        => true,
                        '18'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                        '15.0'                      => true,
                        '18.0'                      => true,
                        '20100101'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Firefox 33; Mac OS X 10.10.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:33.0) Gecko/20100101 Firefox/33.0',
                array(
                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                        '10'                        => true,
                        '15'                        => true,
                        '18'                        => true,
                        '19'                        => true,
                        '33'                        => true,
                    ),

                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                        '15.0'                      => true,
                        '18.0'                      => true,
                        '19.0'                      => true,
                        '20100101'                  => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // SeaMonkey 2.0; Windows.
            array(
                'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b3pre) Gecko/20081208 SeaMonkey/2.0',
                array(
                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051106'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko19',
                    ),
                ),
            ),

            // SeaMonkey 2.1; Linux.
            array(
                'Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20110609 Firefox/4.0.1 SeaMonkey/2.1',
                array(
                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                    ),

                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                        'gecko20',
                    ),
                ),
            ),

            // SeaMonkey 2.3; FreeBSD.
            array(
                'Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0) Gecko/20110818 Firefox/6.0 SeaMonkey/2.3',
                array(
                    'is_gecko'                      => true,
                    'check_gecko_version'           => array(
                        '1'                         => true,
                        '2'                         => true,
                        '20030516'                  => true,
                        '20051116'                  => true,
                        '2006010100'                => true,
                        '20100101'                  => true,
                        '3.6'                       => true,
                        '4.0'                       => true,
                    ),

                    'is_firefox'                    => true,
                    'check_firefox_version'         => array(
                        '1.5'                       => true,
                        '3.0'                       => true,
                        '4'                         => true,
                    ),

                    'versionclasses'                => array(
                        'gecko',
                    ),
                ),
            ),

            // Mac OS X; MS Word 14.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X) Word/14.38.0',
                array(
                    'versionclasses'                => array(
                    ),

                    'is_msword'                     => true,
                ),
            ),

            // Safari 312; Max OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312',
                array(
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'safari',
                    ),
                ),
            ),

            // Safari 412; Max OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412 (KHTML, like Gecko) Safari/412',
                array(
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'safari',
                    ),
                ),
            ),

            // Safari 2.0; Max OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412 (KHTML, like Gecko) Safari/412',
                array(
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'safari',
                    ),
                ),
            ),

            // iOS Safari 528; iPhone.
            array(
                'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; cs-cz) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16',
                array(
                    // Note: We do *not* identify mobile Safari as Safari.
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'ios'
                    ),

                    'devicetype'                    => 'mobile',
               ),
            ),

            // Safari; iPhone 6 Plus; iOS 8.1; Build 12B411.
            array(
                'Mozilla/5.0 (iPhone; CPU iPhone OS 10_10 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4',
                array(
                    // Note: We do *not* identify mobile Safari as Safari.
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                        '590'                       => true,
                        '600'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'ios',
                    ),

                    'devicetype'                    => 'mobile',
               ),
            ),

            // iOS Safari 533; iPad.
            array(
                'Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5',
                array(
                    // Note: We do *not* identify mobile Safari as Safari.
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'ios',
                    ),

                    'devicetype'                    => 'tablet',
               ),
            ),

            // Android WebKit 525; G1 Phone.
            'Android WebKit 525; G1 Phone' => array(
                'Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2 – G1 Phone',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'android',
                    ),

                    'devicetype'                    => 'mobile',

                    'supports_svg'                  => false,
               ),
            ),

            // Android WebKit 530; Nexus.
            'Android WebKit 530; Nexus' => array(
                'Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17 –Nexus',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'android',
                    ),

                    'devicetype'                    => 'mobile',

                    'supports_svg'                  => false,
               ),
            ),

            // Android WebKit 537; Samsung GT-9505.
            array(
                'Mozilla/5.0 (Linux; Android 4.3; it-it; SAMSUNG GT-I9505/I9505XXUEMJ7 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                    ),

                    'versionclasses'                => array(
                        'chrome',
                        'android',
                    ),

                    'devicetype'                    => 'mobile',
                ),
            ),

            // Android WebKit 537; Nexus 5.
            array(
                'Mozilla/5.0 (Linux; Android 5.0; Nexus 5 Build/LPX13D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.102 Mobile Safari/537.36',
                array(
                    'is_webkit_android'             => true,
                    'check_webkit_android_version'  => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),

                    'is_webkit'                     => true,

                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                    ),

                    'versionclasses'                => array(
                        'chrome',
                        'android',
                    ),

                    'devicetype'                    => 'mobile',
                ),
            ),

            // Chrome 8; Mac OS X.
            array(
                'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10',
                array(
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'chrome',
                    ),
                ),
            ),

            // Chrome 39; Mac OS X.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36',
                array(
                    'is_chrome'                     => true,
                    'check_chrome_version'          => array(
                        '7'                         => true,
                        '8'                         => true,
                        '10'                        => true,
                        '39'                        => true,
                    ),

                    'is_webkit'                     => true,

                    'versionclasses'                => array(
                        'chrome',
                    ),
                ),
            ),

            // Opera 12.15 (Build 1748); Mac OS X.
            array(
                'Opera/9.80 (Macintosh; Intel Mac OS X 10.10.0; Edition MAS) Presto/2.12.388 Version/12.15',
                array(
                    'is_opera'                      => true,
                    'check_opera_version'           => array(
                        '8.0'                       => true,
                        '9.0'                       => true,
                        '10.0'                      => true,
                        '12.15'                     => true,
                    ),

                    'versionclasses'                => array(
                        'opera',
                    ),
               ),
            ),

            // Google web crawlers.
            array(
                'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Googlebot/2.1 (+http://www.googlebot.com/bot.html)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Googlebot-Image/1.0',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Yahoo crawlers.
            // See https://help.yahoo.com/kb/slurp-crawling-page-sln22600.html.
            array(
                'Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Bing / MSN / AdIdx crawlers.
            // See http://www.bing.com/webmaster/help/which-crawlers-does-bing-use-8c184ec0.
            array(
                'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (compatible; bingbot/2.0 +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'is_webkit'                     => true,
                    'is_safari_ios'                 => true,
                    'is_ios'                        => true,
                    'check_safari_ios_version'      => array(
                        '527'                       => true,
                    ),

                    'versionclasses'                => array(
                        'ios',
                    ),

                    'devicetype'                    => 'mobile',
               ),
            ),
            array(
                'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'is_ie'                         => true,
                    'check_ie_version'              => array(
                        '0'                         => true,
                        '5.0'                       => true,
                        '5.5'                       => true,
                        '6.0'                       => true,
                        '7.0'                       => true,
                        '8.0'                       => true,
                        '9.0'                       => true,
                        '10'                        => true,
                        '11'                        => true,
                    ),
                    'versionclasses'                => array(
                        'ie',
                        'ie11',
                    ),
                    'devicetype'                    => 'mobile',
               ),
            ),

            array(
                'msnbot/2.0b (+http://search.msn.com/msnbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'msnbot/2.1',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b',
                array(
                    'is_web_crawler'                => true,
                    'is_webkit'                     => true,
                    'is_safari'                     => true,
                    'check_safari_version'          => array(
                        '1'                         => true,
                        '312'                       => true,
                        '500'                       => true,
                    ),

                    'versionclasses'                => array(
                        'safari',
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko BingPreview/1.0b',
                array(
                    'is_web_crawler'                => true,
                    'is_ie'                         => true,
                    'check_ie_version'              => array(
                        '0'                         => true,
                        '5.0'                       => true,
                        '5.5'                       => true,
                        '6.0'                       => true,
                        '7.0'                       => true,
                        '8.0'                       => true,
                        '9.0'                       => true,
                        '10'                        => true,
                        '11'                        => true,
                    ),
                    'versionclasses'                => array(
                        'ie',
                        'ie11',
                    ),
                    'devicetype'                    => 'mobile',
               ),
            ),

            // Yandex.
            // See http://help.yandex.com/search/robots/agent.xml.
            array(
                'Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Mozilla/5.0 (compatible; YandexImages/3.0; +http://yandex.com/bots)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // AltaVista.
            array(
                'AltaVista V2.0B crawler@evreka.com',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // ZoomSpider.
            array(
                'ZoomSpider - wrensoft.com [ZSEBOT]',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Baidu.
            array(
                'Baiduspider+(+http://www.baidu.com/search/spider_jp.html)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),
            array(
                'Baiduspider+(+http://www.baidu.com/search/spider.htm)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Ask.com.
            array(
                'User-Agent: Mozilla/2.0 (compatible; Ask Jeeves/Teoma)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // MoodleBot.
            array(
                'User-Agent: MoodleBot/3.8 (+https://moodle.org)',
                array(
                    'is_web_crawler'                => true,
                    'versionclasses'                => array(
                    ),
               ),
            ),

            // Macos Desktop app.
            array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) moodlemobile/3.6.0 Chrome/69.0.3497.106 Electron/4.0.1 Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'versionclasses'               => array(
                        'chrome',
                    ),
               ),
            ),

            // Linux Desktop app.
            array(
                'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) moodledesktop/3.6.0 Chrome/69.0.3497.106 Electron/4.0.1 Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'versionclasses'               => array(
                        'chrome',
                    ),
               ),
            ),

            // Windows Desktop app.
            array(
                'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) moodledesktop/3.6.0 Chrome/69.0.3497.106 Electron/4.0.1 Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'versionclasses'               => array(
                        'chrome',
                    ),
               ),
            ),

            // Android app.
            array(
                'Mozilla/5.0 (Linux; Android 7.1.1; Moto G Play Build/NPIS26.48-43-2; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_webkit_android'            => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'devicetype'                   => 'mobile',
                    'check_webkit_android_version' => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),
                    'versionclasses'               => array(
                        'android',
                        'chrome'
                    ),
               ),
            ),

            // Android app, user agent lower case.
            array(
                'Mozilla/5.0 (Linux; Android 7.1.1; Moto G Play Build/NPIS26.48-43-2; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36 moodlemobile',
                array(
                    'is_moodle_app'                => true,
                    'is_webkit'                    => true,
                    'is_webkit_android'            => true,
                    'is_chrome'                    => true,
                    'check_chrome_version'         => array(
                        '7'                        => true,
                        '8'                        => true,
                        '10'                       => true,
                        '39'                       => true,
                    ),
                    'devicetype'                   => 'mobile',
                    'check_webkit_android_version' => array(
                        '525'                       => true,
                        '527'                       => true,
                    ),
                    'versionclasses'               => array(
                        'android',
                        'chrome'
                    ),
               ),
            ),

            // iOS (iPhone) app.
            array(
                'Mozilla/5.0 (iPhone; CPU OS 13_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_ios'                       => true,
                    'is_webkit'                    => true,
                    'devicetype'                   => 'mobile',
                    'versionclasses'               => array(
                    ),
               ),
            ),

            // iOS (iPad) app.
            array(
                'Mozilla/5.0 (iPad; CPU OS 12_1_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D39 MoodleMobile',
                array(
                    'is_moodle_app'                => true,
                    'is_ios'                       => true,
                    'is_webkit'                    => true,
                    'devicetype'                   => 'tablet',
                    'versionclasses'               => array(
                    ),
               ),
            ),
        );
    }

    /**
     * Test instance generation.
     */
    public function test_instance(): void {
        $this->assertInstanceOf('core_useragent', core_useragent::instance());
        $this->assertInstanceOf('core_useragent', core_useragent::instance(true));
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_edge($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // Edge Tests.
        if (isset($tests['is_edge']) && $tests['is_edge']) {
            $this->assertTrue(core_useragent::is_edge());
        } else {
            $this->assertFalse(core_useragent::is_edge());
        }

        $versions = array(
            // New versions of should be added here.
            '12'   => false,
        );

        if (isset($tests['check_edge_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_edge_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_edge_version($version),
                "Version incorrectly determined for Edge version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_ie($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // IE Tests.
        if (isset($tests['is_ie']) && $tests['is_ie']) {
            $this->assertTrue(core_useragent::is_ie());
        } else {
            $this->assertFalse(core_useragent::is_ie());
        }

        $versions = array(
            // New versions of should be added here.
            '0'    => false,
            '5.0'  => false,
            '5.5'  => false,
            '6.0'  => false,
            '7.0'  => false,
            '8.0'  => false,
            '9.0'  => false,
            '10'   => false,
            '11'   => false,
            '12'   => false,
            '13'   => false,
            '14'   => false,
        );

        if (isset($tests['check_ie_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_ie_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_ie_version($version),
                "Version incorrectly determined for IE version '{$version}'");
        }

        // IE Compatibility mode.
        if (isset($tests['iecompatibility']) && $tests['iecompatibility']) {
            $this->assertTrue(core_useragent::check_ie_compatibility_view(), "IE Compability false negative");
        } else {
            $this->assertFalse(core_useragent::check_ie_compatibility_view(), "IE Compability false positive");
        }

    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_msword($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // MSWord Tests.
        if (isset($tests['is_msword']) && $tests['is_msword']) {
            $this->assertTrue(core_useragent::is_msword());
        } else {
            $this->assertFalse(core_useragent::is_msword());
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_supports($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        // Supports SVG.
        if (!isset($tests['supports_svg']) || $tests['supports_svg']) {
            $this->assertTrue(core_useragent::supports_svg(),
                "SVG Support was not reported (and should have been)");
        } else {
            $this->assertFalse(core_useragent::supports_svg(),
                "SVG Support was reported (and should not have been)");
        }

        // Supports JSON ContentType.
        if (!isset($tests['supports_json_contenttype']) || $tests['supports_json_contenttype']) {
            $this->assertTrue(core_useragent::supports_json_contenttype(),
                "JSON ContentType Support was not reported (and should have been)");
        } else {
            $this->assertFalse(core_useragent::supports_json_contenttype(),
                "JSON ContentType Support was reported (and should not have been)");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_webkit($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_webkit']) && $tests['is_webkit']) {
            $this->assertTrue(core_useragent::is_webkit(),
                "Browser was not identified as a webkit browser");
            $this->assertTrue(core_useragent::check_webkit_version());
        } else {
            $this->assertFalse(core_useragent::is_webkit(),
                "Browser was incorrectly identified as a webkit browser");
            $this->assertFalse(core_useragent::check_webkit_version());
        }

        $versions = array(
            // New versions should be added here.
        );

        if (isset($tests['check_webkit_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_webkit_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_webkit_version($version),
                "Version incorrectly determined for Webkit version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_webkit_android($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_webkit_android']) && $tests['is_webkit_android']) {
            $this->assertTrue(core_useragent::is_webkit_android(),
                "Browser was not identified as an Android webkit browser");
            $this->assertTrue(core_useragent::check_webkit_android_version());
        } else {
            $this->assertFalse(core_useragent::is_webkit_android(),
                "Browser was incorrectly identified as an Android webkit browser");
            $this->assertFalse(core_useragent::check_webkit_android_version());
        }

        $versions = array(
            // New versions should be added here.
            '525'       => false,
            '527'       => false,
            '590'       => false,
        );

        if (isset($tests['check_webkit_android_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_webkit_android_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_webkit_android_version($version),
                "Version incorrectly determined for Android webkit version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_chrome($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_chrome']) && $tests['is_chrome']) {
            $this->assertTrue(core_useragent::is_chrome(),
                "Browser was not identified as a chrome browser");
            $this->assertTrue(core_useragent::check_chrome_version());
        } else {
            $this->assertFalse(core_useragent::is_chrome(),
                "Browser was incorrectly identified as a chrome browser");
            $this->assertFalse(core_useragent::check_chrome_version());
        }

        $versions = array(
            // New versions should be added here.
            '7'         => false,
            '8'         => false,
            '10'        => false,
            '39'        => false,
        );

        if (isset($tests['check_chrome_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_chrome_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_chrome_version($version),
                "Version incorrectly determined for Chrome version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_safari($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_safari']) && $tests['is_safari']) {
            $this->assertTrue(core_useragent::is_safari(),
                "Browser was not identified as a safari browser");
            $this->assertTrue(core_useragent::check_safari_version());
        } else {
            $this->assertFalse(core_useragent::is_safari(),
                "Browser was incorrectly identified as a safari browser");
            $this->assertFalse(core_useragent::check_safari_version());
        }

        // Check Safari (generic).
        $versions = array(
            // New versions should be added here.
            '1'         => false,
            '312'       => false,
            '500'       => false,
        );

        if (isset($tests['check_safari_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_safari_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_safari_version($version),
                "Version incorrectly determined for Safari (generic) version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_ios_safari($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_safari_ios']) && $tests['is_safari_ios']) {
            $this->assertTrue(core_useragent::is_safari_ios(),
                "Browser was not identified as an iOS safari browser");
            $this->assertTrue(core_useragent::check_safari_ios_version());
        } else {
            $this->assertFalse(core_useragent::is_safari_ios(),
                "Browser was incorrectly identified as an iOS safari browser");
            $this->assertFalse(core_useragent::check_safari_ios_version());
        }

        // Check iOS Safari.
        $versions = array(
            // New versions should be added here.
            '527'       => false,
            '590'       => false,
            '600'       => false,
        );

        if (isset($tests['check_safari_ios_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_safari_ios_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_safari_ios_version($version),
                "Version incorrectly determined for iOS Safari version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_ios($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_ios']) && $tests['is_ios']) {
            $this->assertTrue(core_useragent::is_ios(),
                "Browser was not identified as an iOS device browser");
            // The iOS app is not Safari based.
            if (!isset($tests['is_moodle_app']) || !$tests['is_moodle_app']) {
                $this->assertTrue(core_useragent::check_safari_ios_version());
            }
        } else {
            $this->assertFalse(core_useragent::is_ios(),
                "Browser was incorrectly identified as an iOS device browser");
            $this->assertFalse(core_useragent::check_safari_ios_version());
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_gecko($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_gecko']) && $tests['is_gecko']) {
            $this->assertTrue(core_useragent::is_gecko(),
                "Browser was not identified as a gecko browser");
            $this->assertTrue(core_useragent::check_gecko_version());
        } else {
            $this->assertFalse(core_useragent::is_gecko(),
                "Browser was incorrectly identified as a gecko browser");
            $this->assertFalse(core_useragent::check_gecko_version());
        }

        $versions = array(
            // New versions should be added here.
            '1'             => false,
            '2'             => false,
            '3.6'           => false,
            '4.0'           => false,
            '20030516'      => false,
            '20051116'      => false,
            '2006010100'    => false,
            '20100101'      => false,
            '15.0'          => false,
            '18.0'          => false,
            '19.0'          => false,
        );

        if (isset($tests['check_gecko_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_gecko_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_gecko_version($version),
                "Version incorrectly determined for Gecko version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_firefox($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_firefox']) && $tests['is_firefox']) {
            $this->assertTrue(core_useragent::is_firefox(),
                "Browser was not identified as a firefox browser");
            $this->assertTrue(core_useragent::check_firefox_version());
        } else {
            $this->assertFalse(core_useragent::is_firefox(),
                "Browser was incorrectly identified as a firefox browser");
            $this->assertFalse(core_useragent::check_firefox_version());
        }

        $versions = array(
            // New versions should be added here.
            '1.5'       => false,
            '3.0'       => false,
            '4'         => false,
            '10'        => false,
            '15'        => false,
            '18'        => false,
            '19'        => false,
            '33'        => false,
        );

        if (isset($tests['check_firefox_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_firefox_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_firefox_version($version),
                "Version incorrectly determined for Firefox version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_opera($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        if (isset($tests['is_opera']) && $tests['is_opera']) {
            $this->assertTrue(core_useragent::is_opera(),
                "Browser was not identified as a opera browser");
            $this->assertTrue(core_useragent::check_opera_version());
        } else {
            $this->assertFalse(core_useragent::is_opera(),
                "Browser was incorrectly identified as a opera browser");
            $this->assertFalse(core_useragent::check_opera_version());
        }

        $versions = array(
            // New versions should be added here.
            '8.0'       => false,
            '9.0'       => false,
            '10.0'      => false,
            '12.15'     => false,
        );

        if (isset($tests['check_opera_version'])) {
            // The test provider has overwritten some of the above checks.
            // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
            $versions = $tests['check_opera_version'] + $versions;
        }

        foreach ($versions as $version => $result) {
            $this->assertEquals($result, core_useragent::check_opera_version($version),
                "Version incorrectly determined for Opera version '{$version}'");
        }
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_get_device_type($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $expected = 'default';
        if (isset($tests['devicetype'])) {
            $expected = $tests['devicetype'];
        }

        $this->assertEquals($expected, core_useragent::get_device_type(),
            "Device Type was not correctly identified");
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_get_browser_version_classes($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $actual = core_useragent::get_browser_version_classes();
        foreach ($tests['versionclasses'] as $expectedclass) {
            $this->assertContains($expectedclass, $actual);
        }
        $this->assertCount(count($tests['versionclasses']), $actual);
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_web_crawler($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $expectation = isset($tests['is_web_crawler']) ? $tests['is_web_crawler'] : false;
        $this->assertSame($expectation, core_useragent::is_web_crawler());
    }

    /**
     * @dataProvider user_agents_providers
     */
    public function test_useragent_moodle_app($useragent, $tests): void {
        // Setup the core_useragent instance.
        core_useragent::instance(true, $useragent);

        $expectation = isset($tests['is_moodle_app']) ? $tests['is_moodle_app'] : false;
        $this->assertSame($expectation, core_useragent::is_moodle_app());
    }
}

Filemanager

Name Type Size Permission Actions
analytics Folder 0755
behat Folder 0755
classes Folder 0755
content Folder 0755
context Folder 0755
db Folder 0755
event Folder 0755
external Folder 0755
fixtures Folder 0755
hook Folder 0755
hub Folder 0755
lock Folder 0755
moodlenet Folder 0755
navigation Folder 0755
oauth2 Folder 0755
other Folder 0755
output Folder 0755
performance Folder 0755
plugininfo Folder 0755
privacy Folder 0755
route Folder 0755
router Folder 0755
session Folder 0755
task Folder 0755
accesslib_has_capability_test.php File 29.76 KB 0644
accesslib_test.php File 245.63 KB 0644
adminlib_test.php File 7.42 KB 0644
admintree_test.php File 18.08 KB 0644
ajaxlib_test.php File 4.45 KB 0644
analysers_test.php File 12.71 KB 0644
antivirus_test.php File 11.98 KB 0644
attribute_helper_test.php File 8.41 KB 0644
authlib_test.php File 22.97 KB 0644
behat_lib_test.php File 3.3 KB 0644
blocklib_test.php File 36.31 KB 0644
check_test.php File 2.31 KB 0644
client_test.php File 4.32 KB 0644
collator_test.php File 12.1 KB 0644
completionlib_test.php File 92.46 KB 0644
component_test.php File 49.28 KB 0644
componentlib_test.php File 6.93 KB 0644
configonlylib_test.php File 8.95 KB 0644
content_test.php File 4.79 KB 0644
context_block_test.php File 4.17 KB 0644
context_helper_test.php File 22.28 KB 0644
context_test.php File 3.42 KB 0644
core_media_player_native_test.php File 6.44 KB 0644
core_renderer_template_exploit_test.php File 16.54 KB 0644
core_renderer_test.php File 7.57 KB 0644
core_userfeedback_test.php File 2.3 KB 0644
coverage.php File 3.27 KB 0644
cron_test.php File 6.82 KB 0644
csvclass_test.php File 5.66 KB 0644
curl_security_helper_test.php File 14.88 KB 0644
customcontext_test.php File 4.67 KB 0644
dataformat_test.php File 4.18 KB 0644
datalib_test.php File 48.97 KB 0644
datalib_update_with_unique_index_test.php File 6.12 KB 0644
date_legacy_test.php File 13.67 KB 0644
date_test.php File 30.4 KB 0644
deprecation_test.php File 15.78 KB 0644
di_test.php File 5.33 KB 0644
editorlib_test.php File 1.96 KB 0644
emoticon_manager_test.php File 4.2 KB 0644
encryption_test.php File 9.48 KB 0644
environment_test.php File 9.12 KB 0644
exporter_test.php File 16.83 KB 0644
externallib_test.php File 2.03 KB 0644
filelib_test.php File 83.89 KB 0644
filestorage_zip_archive_test.php File 2.54 KB 0644
filetypes_test.php File 10.09 KB 0644
filter_manager_test.php File 3.33 KB 0644
filterlib_test.php File 37.09 KB 0644
formatting_test.php File 26.09 KB 0644
formslib_test.php File 40.1 KB 0644
gdlib_test.php File 5.73 KB 0644
googlelib_test.php File 1.62 KB 0644
gradelib_test.php File 12.01 KB 0644
grades_external_test.php File 11.22 KB 0644
grading_external_test.php File 26.55 KB 0644
graphlib_test.php File 7.14 KB 0644
grouplib_test.php File 110.79 KB 0644
h5p_clean_orphaned_records_task_test.php File 3.17 KB 0644
html2text_test.php File 8.82 KB 0644
htmlpurifier_test.php File 23.11 KB 0644
http_client_test.php File 14.67 KB 0644
ip_utils_test.php File 19.55 KB 0644
jquery_test.php File 1.59 KB 0644
ldaplib_test.php File 17.77 KB 0644
licenselib_test.php File 11.84 KB 0644
locale_test.php File 4.96 KB 0644
lock_config_test.php File 3.48 KB 0644
lock_test.php File 5.34 KB 0644
markdown_test.php File 2.27 KB 0644
mathslib_test.php File 13.51 KB 0644
medialib_test.php File 19.68 KB 0644
message_test.php File 16.43 KB 0644
messagelib_test.php File 56.44 KB 0644
minify_test.php File 3.15 KB 0644
modinfolib_test.php File 99.71 KB 0644
moodle_page_test.php File 34.62 KB 0644
moodlelib_current_language_test.php File 7.68 KB 0644
moodlelib_partial_test.php File 4.48 KB 0644
moodlelib_test.php File 239.56 KB 0644
myprofilelib_test.php File 12.2 KB 0644
navigationlib_test.php File 32.56 KB 0644
notification_test.php File 4.37 KB 0644
oauth2_test.php File 23.16 KB 0644
outputcomponents_test.php File 34.31 KB 0644
outputfactories_test.php File 6.83 KB 0644
outputrenderers_test.php File 1.63 KB 0644
outputrequirementslib_test.php File 15.72 KB 0644
param_test.php File 4.11 KB 0644
pdflib_test.php File 3.21 KB 0644
persistent_test.php File 30.68 KB 0644
phpxmlrpc_test.php File 2.05 KB 0644
plugin_manager_test.php File 31.47 KB 0644
portfoliolib_test.php File 8.41 KB 0644
progress_display_test.php File 3.76 KB 0644
progress_test.php File 14.53 KB 0644
qrcode_test.php File 1.69 KB 0644
questionlib_test.php File 108.63 KB 0644
regex_test.php File 1.56 KB 0644
report_helper_test.php File 7 KB 0644
requirejs_test.php File 2.23 KB 0644
router_test.php File 3.85 KB 0644
rsslib_test.php File 7.41 KB 0644
rtlcss_test.php File 57.07 KB 0644
sample_questions.ser File 141.76 KB 0644
sample_questions.xml File 102.62 KB 0644
sample_questions_with_old_image_tag.ser File 4.85 KB 0644
sample_questions_with_old_image_tag.xml File 4.08 KB 0644
sample_questions_wrong.xml File 102.57 KB 0644
scss_test.php File 4.31 KB 0644
session_redis_cluster_test.php File 4.17 KB 0644
sessionlib_test.php File 12.37 KB 0644
setuplib_test.php File 20.21 KB 0644
statslib_test.php File 26.82 KB 0644
stored_progress_bar_test.php File 7.17 KB 0644
string_manager_standard_test.php File 10.23 KB 0644
system_clock_test.php File 2.42 KB 0644
text_test.php File 26.68 KB 0644
theme_config_test.php File 7.25 KB 0644
update_api_test.php File 6.65 KB 0644
update_checker_test.php File 10.91 KB 0644
update_code_manager_test.php File 9.12 KB 0644
update_validator_test.php File 18.32 KB 0644
upgrade_util_test.php File 5.36 KB 0644
upgradelib_test.php File 75.43 KB 0644
url_test.php File 25.48 KB 0644
user_menu_test.php File 3.83 KB 0644
user_test.php File 42.3 KB 0644
useragent_test.php File 67.06 KB 0644
weblib_format_text_test.php File 14.21 KB 0644
weblib_test.php File 42.12 KB 0644
xhprof_test.php File 10.05 KB 0644
xmlize_test.php File 2.57 KB 0644
xsendfilelib_test.php File 5 KB 0644
Filemanager