__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?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/>.
namespace core_user;
use stdClass;
/**
* Tests for the devicekey class.
*
* @package core_user
* @covers \core_user\devicekey
*/
final class devicekey_test extends \advanced_testcase {
/**
* Helper to create a device record.
*
* @return stdClass
*/
protected function create_device_record(): stdClass {
global $USER, $DB;
$device = (object) [
'appid' => 'com.moodle.moodlemobile',
'name' => 'occam',
'model' => 'Nexus 4',
'platform' => 'Android',
'version' => '4.2.2',
'pushid' => 'apushdkasdfj4835',
'uuid' => 'ABCDE3723ksdfhasfaasef859',
'userid' => $USER->id,
'timecreated' => time(),
'timemodified' => time(),
];
$device->id = $DB->insert_record('user_devices', $device);
return $device;
}
public function test_update_device_public_key_no_device(): void {
global $DB;
$this->resetAfterTest();
$this->setAdminUser();
$device = $this->create_device_record();
$devicekeypair = sodium_crypto_box_keypair();
$publickey = sodium_bin2base64(
sodium_crypto_box_publickey($devicekeypair),
SODIUM_BASE64_VARIANT_ORIGINAL
);
$this->assertTrue(devicekey::update_device_public_key($device->uuid, $device->appid, $publickey));
$this->assertEquals($publickey, $DB->get_field('user_devices', 'publickey', ['id' => $device->id]));
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| behat | Folder | 0777 |
|
|
| external | Folder | 0777 |
|
|
| fixtures | Folder | 0777 |
|
|
| privacy | Folder | 0777 |
|
|
| reportbuilder | Folder | 0777 |
|
|
| route | Folder | 0777 |
|
|
| search | Folder | 0777 |
|
|
| table | Folder | 0777 |
|
|
| coverage.php | File | 1.08 KB | 0777 |
|
| devicekey_test.php | File | 2.17 KB | 0777 |
|
| editlib_test.php | File | 7.4 KB | 0777 |
|
| externallib_test.php | File | 78.31 KB | 0777 |
|
| fields_test.php | File | 27.77 KB | 0777 |
|
| group_non_members_selector_test.php | File | 4.84 KB | 0777 |
|
| myprofile_test.php | File | 15.9 KB | 0777 |
|
| profilelib_test.php | File | 14.91 KB | 0777 |
|
| userlib_test.php | File | 47.45 KB | 0777 |
|
| userroleseditable_test.php | File | 2.98 KB | 0777 |
|
| userselector_test.php | File | 10.54 KB | 0777 |
|