mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Gazelle;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use GazelleUnitTest\Helper;
|
|
|
|
class UserNavigationTest extends TestCase {
|
|
protected User $user;
|
|
|
|
public function setUp(): void {
|
|
$this->user = Helper::makeUser('user.' . randomString(10), 'forum');
|
|
}
|
|
|
|
public function tearDown(): void {
|
|
$this->user->remove();
|
|
}
|
|
|
|
public function testNavigationBasic(): void {
|
|
$manager = new Manager\UserNavigation();
|
|
$this->assertNull($manager->findById(0), 'user-nav-find-by-id');
|
|
global $Cache;
|
|
$Cache->delete_value(Manager\UserNavigation::LIST_KEY);
|
|
$fullList = $manager->fullList();
|
|
$this->assertCount(12, $fullList, 'user-nav-manager-full');
|
|
|
|
$this->assertTrue(
|
|
$this->user->setField('nav_list', [$fullList[3]["id"], $fullList[2]["id"], $fullList[1]["id"]])->modify(),
|
|
'user-nav-modify'
|
|
);
|
|
$userList = $manager->userControlList($this->user);
|
|
$this->assertCount(3, $userList, 'user-nav-count');
|
|
$this->assertEquals($fullList[2]["id"], $userList[1]["id"], 'user-nav-order');
|
|
}
|
|
}
|