Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/private/NavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function setUnreadCounter(string $id, int $unreadCounter): void {
#[Override]
public function get(string $id): ?array {
$this->resolveAppNavigationEntries();
return $this->entries[$id];
return $this->entries[$id] ?? null;
}

#[Override]
Expand Down
7 changes: 7 additions & 0 deletions tests/lib/NavigationManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ public function testAddClosure(array $entry, array $expectedEntry): void {
$this->assertEmpty($this->navigationManager->getAll('all'), 'Expected no navigation entry exists after clear()');
}

public function testGetUnknownEntryReturnsNull(): void {
// Requesting an entry no app has registered must return null without
// emitting an "Undefined array key" warning, e.g. when an app without
// a navigation entry renders a public page
$this->assertNull($this->navigationManager->get('unknown'));
}

public function testAddArrayClearGetAll(): void {
$entry = [
'id' => 'entry id',
Expand Down
Loading