Files
ops-Gazelle/tests/phpunit/UserNavigationTest.php
T

33 lines
1.0 KiB
PHP

<?php
use PHPUnit\Framework\TestCase;
require_once(__DIR__ . '/../../lib/bootstrap.php');
require_once(__DIR__ . '/../helper.php');
class UserNavigationTest extends TestCase {
protected Gazelle\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 Gazelle\Manager\UserNavigation();
$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');
}
}