Skip to content

WebControls rest second path audit (#1497) - #1683

Merged
ctrlaltca merged 4 commits into
pradosoft:masterfrom
belisoful:wc-rest-second-audit
Nov 29, 2026
Merged

ctrlaltca merged 4 commits into
pradosoft:masterfrom
belisoful:wc-rest-second-audit

Conversation

@belisoful

@belisoful belisoful commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Part of #1497 (WebControls: HTML elements, tables, media, and the rest). This is the item's second path audit, run on current master. It covers the 169 files of #1642, #1647, #1665, #1673, and #1675. It changes only tests.

Test fixes

Each fix is its own commit.

  • TJsonLdTest::testRenderCombinationsOfSourceAndNonce never ran. It was declared inside the TJsonLdTestThrowingControl fixture class, after its render(), so PHPUnit did not collect it. It now sits in TJsonLdTest. A scan of tests/unit finds no other test* method outside a test case, apart from the intended fixtures in PradoBaseTest.
  • TRelativeTimeTest::testAttributeCombinationsOfDateTimeToolTipAndEnhancement never left DateTime unset. setDateTime('') stores the current time, so the unset half rendered a set DateTime. That half now builds a control without one.
  • TCronWakeSocketTest failed on some Windows runners. Windows uses the udp transport. The tests bound the default ports 52800 to 52802. Windows reserves random port ranges at boot, so a runner could refuse 52800 with "forbidden by its access permissions", which failed six tests. The tests now probe for a base port whose three ports bind. The test that checks the default port number keeps it. With 52800 held, the old tests fail the same six ways locally over udp, and the new ones pass.

New tests

Reachable paths in methods with 16 or fewer paths:

Area Control Paths now tested
Base TWebControl Microdata attributes without ItemScope
Media TVideo, TMediaSource, TTextTrack Every attribute combination; TVideo now hits all its paths
Media TMetaTag Every attribute with Charset
Media TOpenGraph Meta tags with no og: properties
Media TStyleSheet A Prado style without a URL
Media TClientScript A single Prado script
Media TCanvas getClientEnhanced() false without OnDraw, without a page, and without JavaScript
Media TSvg A decorative graphic needs no text alternative
Media TSvgDocument getTitle() and removeTitles() over text-only, title-only, and description-only children
Media TDot setColor() with - and a hex value; nudge() at the channel ceiling with a null style
Text TAuthViewTemplate canAny() without permissions
Text TBaseTerm Empty term keys; an untitled term under a MarkLimit; getMarkCounts() over other elements; markText() without a match
Text TDataSize unitFromMagnitude() without marketing sizes, and past its last unit
Text TLoginName A guest that is not a TComponent, with DisplayGuest
Text TMeter setHigh(null)
Text TReferenceList HeaderLevel 0; back links without references; a negative reference letter index
Text TSafetyCover Every face combination of label, CSS class, color, and overlay; a body of strings only, of renderables only, or of filter renderables only; setOverlayTemplate(null) without an overlay
Text TXmlTransform A body document without parameters

TDataSize now covers every line and branch. Its unitFromMagnitude() guards were listed as unreachable in #1673. They are reachable through the protected method.

Remaining missed paths

Each remaining missed path in a method with 16 or fewer paths is one of these:

  • It follows an operand that short-circuited, or a ternary branch that does not match its condition.
  • It needs a loop whose passes take different branches. Xdebug records a loop path only when every pass takes the same branch. A mixed run records no path.
  • It needs a loop count or state that the code rules out. Examples: getElementsByTagName('*') always yields the root <svg> first, TFont sets a flag with every name and size, and a set InFormRender always has a form.
  • It passes through try/finally, which Xdebug does not record.
  • It ends in an exception thrown by a callee, which Xdebug does not record under PHPUnit here. Tests already cover the TStyle::__call fallthroughs and TDot::setColor(''), but their paths do not show.

The default and ICU fallbacks that #1673 lists in TTime, TRelativeTime, and TXmlTransform are unchanged. Group B, the tables, has no reachable gap.

Checks

  • The full unit suite passes on PHP 8.2.
  • The changed test classes pass on 8.3, 8.4, 8.5, and 8.6.
  • php-cs-fixer and PHPStan are clean.

@ctrlaltca
ctrlaltca merged commit a882b35 into pradosoft:master Nov 29, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants