Skip to content
Merged
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 language/ar/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'أحدث المواضيع',
'RT_NO_TOPICS' => 'لا توجد مواضيع جديدة لعرضها.',
'LIKES' => 'إعجابات',
'VIEWING_RECENT_TOPICS' => 'يتصفح <a href="%s">أحدث المواضيع</a>',
'VIEWING_RECENT_TOPICS' => 'يتصفح أحدث المواضيع',
'EXTENSION_REQUIRES_330' => 'هذا الامتداد يتطلب phpBB 3.3.0 أو أعلى.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/cs/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'RECENT_TOPICS' => 'Nedávná témata',
'RT_NO_TOPICS' => 'Žádná nedávná témata.',
'LIKES' => 'Lajky',
'VIEWING_RECENT_TOPICS' => 'Prohlíží <a href="%s">Nedávná témata</a>',
'VIEWING_RECENT_TOPICS' => 'Prohlíží Nedávná témata',
'EXTENSION_REQUIRES_330' => 'Tato extenze vyžaduje phpBB 3.3.0 nebo vyšší.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/de/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Aktuelle Themen',
'RT_NO_TOPICS' => 'Es sind keine neuen Themen vorhanden.',
'LIKES' => 'Likes',
'VIEWING_RECENT_TOPICS' => 'Schaut sich <a href="%s">Aktuelle Themen</a> an',
'VIEWING_RECENT_TOPICS' => 'Schaut sich Aktuelle Themen an',
'EXTENSION_REQUIRES_330' => 'Diese Erweiterung benötigt phpBB 3.3.0 oder höher.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/de_x_sie/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Aktuelle Themen',
'RT_NO_TOPICS' => 'Es sind keine neuen Themen vorhanden.',
'LIKES' => 'Likes',
'VIEWING_RECENT_TOPICS' => 'Schaut sich <a href="%s">Aktuelle Themen</a> an',
'VIEWING_RECENT_TOPICS' => 'Schaut sich Aktuelle Themen an',
'EXTENSION_REQUIRES_330' => 'Diese Erweiterung benötigt phpBB 3.3.0 oder höher.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/en/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Recent Topics',
'RT_NO_TOPICS' => 'There are no new topics to display.',
'LIKES' => 'Likes',
'VIEWING_RECENT_TOPICS' => 'Viewing <a href="%s">Recent Topics</a>',
'VIEWING_RECENT_TOPICS' => 'Viewing Recent Topics',
'EXTENSION_REQUIRES_330' => 'This extension requires phpBB 3.3.0 or higher.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/es/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Temas Recientes',
'RT_NO_TOPICS' => 'No hay nuevos temas que mostrar.',
'LIKES' => 'Me gusta',
'VIEWING_RECENT_TOPICS' => 'Viendo <a href="%s">Temas Recientes</a>',
'VIEWING_RECENT_TOPICS' => 'Viendo Temas Recientes',
'EXTENSION_REQUIRES_330' => 'Esta extensión requiere phpBB 3.3.0 o superior.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/es_x_tu/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Temas Recientes',
'RT_NO_TOPICS' => 'No hay nuevos temas que mostrar.',
'LIKES' => 'Me gusta',
'VIEWING_RECENT_TOPICS' => 'Viendo <a href="%s">Temas Recientes</a>',
'VIEWING_RECENT_TOPICS' => 'Viendo Temas Recientes',
'EXTENSION_REQUIRES_330' => 'Esta extensión requiere phpBB 3.3.0 o superior.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/fr/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'RECENT_TOPICS' => 'Sujets récents',
'RT_NO_TOPICS' => 'Il n’y a aucun nouveau sujet à afficher.',
'LIKES' => 'J’aime',
'VIEWING_RECENT_TOPICS' => 'Consulte les <a href="%s">Sujets récents</a>',
'VIEWING_RECENT_TOPICS' => 'Consulte les Sujets récents',
'EXTENSION_REQUIRES_330' => 'Cette extension nécessite phpBB 3.3.0 ou supérieur.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/nl/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Recente Onderwerpen',
'RT_NO_TOPICS' => 'Er zijn geen recente onderwerpen weer te geven.',
'LIKES' => 'Likes',
'VIEWING_RECENT_TOPICS' => 'Bekijkt <a href="%s">Recente Onderwerpen</a>',
'VIEWING_RECENT_TOPICS' => 'Bekijkt Recente Onderwerpen',
'EXTENSION_REQUIRES_330' => 'Deze extensie vereist phpBB 3.3.0 of hoger.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/pt/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Tópicos Recentes',
'RT_NO_TOPICS' => 'Não há novos tópicos a serem exibidos.',
'LIKES' => 'Gostos',
'VIEWING_RECENT_TOPICS' => 'Visualizando <a href="%s">Tópicos Recentes</a>',
'VIEWING_RECENT_TOPICS' => 'Visualizando Tópicos Recentes',
'EXTENSION_REQUIRES_330' => 'Esta extensão requer o phpBB 3.3.0 ou superior.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/ru/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'RECENT_TOPICS' => 'Последние темы',
'RT_NO_TOPICS' => 'Нет последних тем для отображения.',
'LIKES' => 'Лайки',
'VIEWING_RECENT_TOPICS' => 'Просматривает <a href="%s">Последние темы</a>',
'VIEWING_RECENT_TOPICS' => 'Просматривает Последние темы',
'EXTENSION_REQUIRES_330' => 'Это расширение требует phpBB 3.3.0 или выше.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/sk/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Najnovšie témy',
'RT_NO_TOPICS' => 'Nie sú žiadne nové témy na zobrazenie.',
'LIKES' => 'Lajky',
'VIEWING_RECENT_TOPICS' => 'Prezerá <a href="%s">Najnovšie témy</a>',
'VIEWING_RECENT_TOPICS' => 'Prezerá Najnovšie témy',
'EXTENSION_REQUIRES_330' => 'Toto rozšírenie vyžaduje phpBB 3.3.0 alebo vyššie.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/sv/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'RECENT_TOPICS' => 'Senaste trådar',
'RT_NO_TOPICS' => 'Det finns inga nya trådar att visa.',
'LIKES' => 'Gillningar',
'VIEWING_RECENT_TOPICS' => 'Visar <a href="%s">Senaste trådar</a>',
'VIEWING_RECENT_TOPICS' => 'Visar Senaste trådar',
'EXTENSION_REQUIRES_330' => 'Detta tillägg kräver phpBB 3.3.0 eller högre.',

// is_enableable() error messages
Expand Down
2 changes: 1 addition & 1 deletion language/uk/recenttopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'RECENT_TOPICS' => 'Останні Теми',
'RT_NO_TOPICS' => 'Немає нових тем.',
'LIKES' => 'Вподобання',
'VIEWING_RECENT_TOPICS' => 'Переглядає <a href="%s">Останні Теми</a>',
'VIEWING_RECENT_TOPICS' => 'Переглядає Останні Теми',
'EXTENSION_REQUIRES_330' => 'Це розширення потребує phpBB 3.3.0 або вище.',

// is_enableable() error messages
Expand Down
47 changes: 47 additions & 0 deletions tests/language/viewonline_lang_test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
*
* @package Recent Topics Extension
* @copyright (c) 2026 Andreas Vandenberghe
* @license GNU General Public License, version 2 (GPL-2.0)
*
* Checks the Who Is Online label in every language pack.
*
* See: https://github.com/avatharbe/RecentTopics/issues/199
*/

namespace avathar\recenttopics\tests\language;

class viewonline_lang_test extends \phpbb_test_case
{
/**
* One row per language pack shipped with the extension.
*/
public function language_data()
{
$data = [];
foreach (glob(__DIR__ . '/../../language/*/recenttopics.php') as $file)
{
$data[basename(dirname($file))] = [$file];
}

return $data;
}

/**
* Who Is Online already wraps the location in <a href="{U_FORUM_LOCATION}">, and the listener
* passes no argument, so VIEWING_RECENT_TOPICS must be plain text: a nested link with an
* unfilled %s broke the label (#199).
*
* @dataProvider language_data
*/
public function test_viewing_recent_topics_is_plain_text($file)
{
$lang = [];
include $file;

$this->assertArrayHasKey('VIEWING_RECENT_TOPICS', $lang);
$this->assertStringNotContainsString('<', $lang['VIEWING_RECENT_TOPICS']);
$this->assertStringNotContainsString('%', $lang['VIEWING_RECENT_TOPICS']);
}
}
18 changes: 17 additions & 1 deletion tests/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ tests/
│ ├── topic_count_test.php "Show all pages" count uses the forum list
│ ├── topic_likes_test.php ACP "Show like counts" setting
│ └── recenttopics_events_test.php Public event API contract (contrib/events.md)
├── language/
│ └── viewonline_lang_test.php Who Is Online label in every language pack
└── functional/
└── recenttopics_test.php End-to-end browser tests
```
Expand Down Expand Up @@ -208,7 +210,21 @@ It runs `fill_template()` for one topic with a stand-in Post Love service that r

---

## 8. Functional tests (`functional/recenttopics_test.php`)
## 8. Who Is Online label (`language/viewonline_lang_test.php`)

**What this code does:**
When someone is on `/app.php/rt` or `/app.php/rt/simple`, the listener sets their Who Is Online location to `VIEWING_RECENT_TOPICS` and the link to the page. Core's `viewonline_body.html` wraps that label in its own `<a href="{U_FORUM_LOCATION}">`.

**What this test file does:**
It loads `recenttopics.php` from every language pack and checks that `VIEWING_RECENT_TOPICS` is plain text: no HTML and no `%` placeholder.

| Test | Scenario | What it verifies |
|------|----------|-----------------|
| `test_viewing_recent_topics_is_plain_text` | Data provider: one row per language pack | The label has no `<` and no `%`. The packs used to carry `<a href="%s">…</a>`, which nested a link with an unfilled `%s` inside core's link (#199) |

---

## 9. Functional tests (`functional/recenttopics_test.php`)

**What this code does:**
These tests start a real phpBB installation (using the test framework's built-in install), enable the extension, and make HTTP requests using a real browser-like crawler (Symfony DomCrawler). They check the actual rendered HTML for specific elements.
Expand Down
Loading