Task Issue 915 TestSpec PerVersion Platform Assignment - sebiboga/testlink-upgraded GitHub Wiki

Task 915 — Per-testcase-version platform assignment in Test Specification (gap vs legacy)

Issue: #915 Status: IMPLEMENTED (2026-09-15)

The gap

The legacy editor (tcEdit.tpl + platforms.inc.tpl, backed by lib/testcases/tcEdit.php addPlatform/removePlatform and testcase.class.php addPlatforms/deletePlatforms/getPlatforms) lets a user assign platforms to a specific test case version — a testcase_platforms row per (testcase_id, tcversion_id, platform_id). Design-visible platforms (enable_on_design = 1) are shown as a clickable picker: assigned ones become red removable chips, unassigned ones are "add" links.

The modern testSpec.html editor, the tcEdit.html standalone editor and both viewers dropped this: there was no platform UI and the modern BFF neither exposed platform data nor persisted assignments.

Modern implementation (port)

BFF api/testcases/index.php

  • Helpers projectPlatforms(), versionPlatformAssignments(), platformFreeList(), canAssignPlatforms() (== legacy platRW: mgt_modify_tc + open version + not executed), resolveTcversionForPlatform(), versionHasExecutions().
  • get returns platformsAssigned, platformsFree, platformsProject, platformsEditable; view returns platformsProject + per-version platforms / canAssignPlatforms.
  • New POST routes add_platform (addPlatforms, design-visible only, open + not executed) and remove_platform (deletePlatforms / deletePlatformsByLink).
  • create / update diff-sync a platforms array against testcase_platforms (shared $syncPlatforms closure).

BFF api/testcasesedit/index.php

  • buildEditPayload() returns platformsAssigned, platformsFree, platformsProject, platformsEditable under tcase; update persists the platform set.

Frontend

  • testSpec.html: platformsEditorHtml() renders a tspec.platforms block (assigned chips + checkbox multi-select #platList, "no platforms / none assigned" notes); hidden in create mode; collectForm() sends the checked ids; read-only renderTcView() shows the platform chips row; openEditTc() / switchEditVersion() thread the platforms* payload.
  • tcEdit.html: Platforms pills section, renderPlatforms() / collectPlatforms(), persisted via update.
  • tcView.html: read-only tcview.platforms chips row.

New-version copy — create_version goes through legacy core create_new_version() which copies the source version's platforms to the new version (copyPlatformsTo, delete:false) — verified live.

i18n — tcedit.platforms, tcedit.noPlatforms, tcview.platforms, tspec.platforms, tspec.noProjPlatforms, tspec.noPlatformsAssigned added to all 10 bundles (en/de/es/fr/it/ja/pt/ro/ru/zh).

Screenshots

Test Specification read-only view — PLATFORMS chips row:

testSpec viewer platforms

Standalone TC editor (tcEdit.html) — Platforms pills:

tcEdit platforms

Standalone TC viewer (tcView.html) — PLATFORMS chips:

tcView platform rows

Verification

  • testSpec editor: uncheck iOS → Save → testcase_platforms row for platform 2 gone (only Android + Windows remain); check again → row recreated.
  • tcEdit editor: pills toggle + Save → new testcase_platforms link row for iOS.
  • tcView + testSpec viewers show the version's platforms.
  • create_version cloned the 3 platform rows to the new version.
  • No new events Error/Warning rows; browser consoles clean.

Related issue

  • #1512 — bug found during testing: delete_version leaves orphaned testcase_platforms rows (pre-existing legacy _blind_delete behavior), minor.

Files changed

  • api/testcases/index.php
  • api/testcasesedit/index.php
  • gui/templates/testcases/testSpec.html
  • gui/templates/testcases/tcEdit.html
  • gui/templates/testcases/tcView.html
  • gui/templates/i18n/{en,de,es,fr,it,ja,pt,ro,ru,zh}.json
  • docs/Task-Issue-915-TestSpec-PerVersion-Platform-Assignment.md
  • CHANGELOG