fix(tests): Standardize tests for clarity and consistency across all test cases.#51
fix(tests): Standardize tests for clarity and consistency across all test cases.#51terabytesoftw merged 3 commits intomainfrom
tests for clarity and consistency across all test cases.#51Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 155 155
===========================================
Files 80 80
Lines 370 370
===========================================
Hits 370 370 ☔ View full report in Codecov by Sentry. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (18)
📝 WalkthroughWalkthroughThis PR standardizes test expectations across the entire test suite for clarity and consistency. Changes include replacing data-test attributes with class, normalizing test values to generic placeholders, adding BackedString enum support, and introducing new test methods for attribute rendering scenarios. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes The changes, while extensive in file count (~45 test files), follow a highly repetitive and consistent pattern across all files: replacing data-test attributes with class, normalizing test values to generic placeholders like "value", adding BackedString and Type imports, and introducing nearly identical new test methods. This homogeneous nature of changes significantly reduces the cognitive load despite the large scope, making the review straightforward once the pattern is understood. Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (12)
tests/List/LiTest.php (1)
498-511:⚠️ Potential issue | 🟡 Minor
testRenderWithoutValueis now a duplicate oftestRenderWithContent.After changing lines 503–507 to use
->content('value'), this method is functionally identical totestRenderWithContent(lines 244–257) — same factory call, same expected HTML output, only the assertion message differs.The original intent of
testRenderWithoutValuewas almost certainly to verify that a<li>element renders without avalueHTML attribute, as a counterpart totestRenderWithValue. The method should either be removed (the scenario is already covered) or corrected to test a distinct case — for example, a bareLi::tag()->render()with novalueattribute set:🛠️ Proposed fix to restore distinct intent
public function testRenderWithoutValue(): void { self::assertSame( <<<HTML <li> </li> HTML, Li::tag() - ->content('value') ->render(), "Failed asserting that element renders correctly without 'value' attribute.", ); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/List/LiTest.php` around lines 498 - 511, testRenderWithoutValue is now a duplicate of testRenderWithContent; restore its original distinct intent by changing the test to render a bare Li::tag() with no content or value attribute and assert the empty <li> output (i.e. call Li::tag()->render() instead of ->content('value')) so it verifies rendering without a value attribute rather than duplicating testRenderWithContent.tests/List/OlTest.php (2)
404-424:⚠️ Potential issue | 🟡 Minor
SimpleFactory::setDefaults()reset is not guarded bytry/finally.If
assertSame()throws (assertion failure), the trailingSimpleFactory::setDefaults(Ol::class, [])call is skipped, leaving global state dirty and potentially contaminating subsequent tests. This is a pre-existing pattern, but worth addressing with atry/finally.🛡️ Proposed fix (same pattern for both affected methods)
SimpleFactory::setDefaults( Ol::class, ['class' => 'default-class'], ); + try { self::assertSame( <<<HTML <ol class="default-class"> </ol> HTML, Ol::tag()->render(), 'Failed asserting that global defaults are applied correctly.', ); + } finally { + SimpleFactory::setDefaults( + Ol::class, + [], + ); + } - - SimpleFactory::setDefaults( - Ol::class, - [], - );Also applies to: 832-855
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/List/OlTest.php` around lines 404 - 424, The test testRenderWithGlobalDefaultsAreApplied sets global defaults via SimpleFactory::setDefaults(Ol::class, ...) but resets them unguarded at the end, which can leave global state dirty if the assertion fails; wrap the assertion and any code that relies on the defaults in a try/finally and move the trailing SimpleFactory::setDefaults(Ol::class, []) into the finally block so the reset always runs even on assertion failures (apply the same pattern to the other affected tests mentioned).
273-285: 🧹 Nitpick | 🔵 Trivial
*UsingEnumassertion messages no longer distinguish the enum code path.After the standardization,
testRenderWithContentEditableUsingEnum,testRenderWithDirUsingEnum,testRenderWithDraggableUsingEnum,testRenderWithLangUsingEnum,testRenderWithRoleUsingEnum,testRenderWithSetAttributeUsingEnum, andtestRenderWithTranslateUsingEnumall carry messages identical to their scalar counterparts. A failure output will say e.g."Failed asserting that element renders correctly with 'dir' attribute."without indicating it was the enum variant that failed.Consider retaining
enumin the message to preserve diagnostics:🔧 Example for
testRenderWithDirUsingEnum(same pattern for all seven methods)- "Failed asserting that element renders correctly with 'dir' attribute.", + "Failed asserting that element renders correctly with 'dir' attribute using enum.",Also applies to: 343-355, 371-383, 485-497, 643-655, 671-683, 818-830
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/List/OlTest.php` around lines 273 - 285, Update the failure messages for the enum-based tests so they indicate the enum code path: change the assertion messages in testRenderWithContentEditableUsingEnum, testRenderWithDirUsingEnum, testRenderWithDraggableUsingEnum, testRenderWithLangUsingEnum, testRenderWithRoleUsingEnum, testRenderWithSetAttributeUsingEnum, and testRenderWithTranslateUsingEnum to include "using enum" or "UsingEnum" (e.g., "Failed asserting that element renders correctly with 'contentEditable' attribute using enum.") so failures clearly distinguish the enum variant from the scalar variant.tests/Phrasing/LabelTest.php (1)
502-513:⚠️ Potential issue | 🟡 MinorCorrect the
styleattribute expectation to use double quotes, consistent with all other attributes in this test class.Line 506 expects
<label style='value'></label>with single quotes, but every other attribute test in this file uses double quotes (e.g.,id="value",class="value",for="value"). This inconsistency will cause the test to fail when the renderer outputs the standard double-quoted format.Change:
<label style='value'></label>to:
<label style="value"></label>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Phrasing/LabelTest.php` around lines 502 - 513, The test expectation in testRenderWithStyle is using single quotes for the style attribute which is inconsistent with the renderer's double-quoted output; update the expected HTML string in testRenderWithStyle (the assertion comparing the heredoc to Label::tag()->style('value')->render()) to use double quotes for the style attribute: change "<label style='value'></label>" to "<label style=\"value\"></label>" so the expected string matches the renderer's format.tests/Metadata/StyleTest.php (1)
851-875:⚠️ Potential issue | 🟠 Major
$style->blocking('')will throwInvalidArgumentExceptionrather than returning a new instance.The test
testThrowInvalidArgumentExceptionForSettingBlockingproves thatblocking()validates againstBlocking::cases(). Since the empty string''is not a validBlockingenum case, the call will throw before theassertNotSameassertion is evaluated, causing an unexpected test failure. Use a known-valid enum value such asBlocking::RENDERinstead.Suggested fix
self::assertNotSame( $style, - $style->blocking(''), + $style->blocking(Blocking::RENDER), 'Should return a new instance when setting the attribute, ensuring immutability.', );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Metadata/StyleTest.php` around lines 851 - 875, The test testReturnNewInstanceWhenSettingAttribute uses Style::blocking('') which throws InvalidArgumentException because '' is not a valid Blocking enum case; change the call to use a known-valid enum value (e.g. Blocking::RENDER) so Style::blocking(...) returns a new instance instead of throwing; update the assertion that calls $style->blocking(...) and import/reference the Blocking enum where needed while leaving the other assertions (media, nonce, type) unchanged.tests/Form/InputResetTest.php (1)
535-546:⚠️ Potential issue | 🟡 Minor
testRenderWithIdis now a duplicate oftestRenderWithDefaultValues.After changing line 542 to
->id('inputreset'), this test renders<input id="inputreset" type="reset">— exactly the same output astestRenderWithDefaultValues(Lines 412–423). The two methods are now functionally identical; only their assertion message differs.testRenderWithIdshould exercise theid()method with a value that differs from the auto-generated default (e.g.,'value', consistent with the PR's standardization) to provide distinct test coverage.🛠 Proposed fix
public function testRenderWithId(): void { self::assertSame( <<<HTML - <input id="inputreset" type="reset"> + <input id="value" type="reset"> HTML, InputReset::tag() - ->id('inputreset') + ->id('value') ->render(), "Failed asserting that element renders correctly with 'id' attribute.", ); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Form/InputResetTest.php` around lines 535 - 546, The test testRenderWithId duplicates testRenderWithDefaultValues because it sets ->id('inputreset') which matches the default output; change the id value used in testRenderWithId to a non-default (e.g., 'value') and update the expected HEREDOC to "<input id=\"value\" type=\"reset\">" so InputReset::tag()->id('value')->render() is asserted against a distinct output from testRenderWithDefaultValues.tests/Heading/H3Test.php (1)
527-540:⚠️ Potential issue | 🟡 MinorMissed standardization:
testRenderWithRemoveDataAttributestill uses'test'as data value.While this method was not modified in this PR, its data value
'test'is inconsistent with the'value'placeholder adopted everywhere else in the suite (includingHtmlTest.php,HGroupTest.php,NavTest.php,PTest.php). Since this PR's stated goal is full-suite standardization, this method should also be aligned.🛠 Proposed fix
- H3::tag() - ->addDataAttribute('value', 'test') - ->removeDataAttribute('value') + H3::tag() + ->addDataAttribute('value', 'value') + ->removeDataAttribute('value')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Heading/H3Test.php` around lines 527 - 540, The test testRenderWithRemoveDataAttribute uses the literal 'test' for the data attribute value instead of the standardized 'value' placeholder; update the H3 test to call H3::tag()->addDataAttribute('value', 'value')->removeDataAttribute('value')->render() (i.e., replace the second argument 'test' with 'value') so the test matches the suite-wide standard while keeping the same call sequence to addDataAttribute and removeDataAttribute.tests/Heading/H1Test.php (1)
527-540:⚠️ Potential issue | 🟡 MinorMissed standardization:
testRenderWithRemoveDataAttributestill uses'test'as data value.Same issue as
H3Test.php— the value'test'in->addDataAttribute('value', 'test')is inconsistent with the'value'placeholder used in every other test file in this PR.🛠 Proposed fix
- H1::tag() - ->addDataAttribute('value', 'test') - ->removeDataAttribute('value') + H1::tag() + ->addDataAttribute('value', 'value') + ->removeDataAttribute('value')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Heading/H1Test.php` around lines 527 - 540, Update the testRenderWithRemoveDataAttribute unit test to use the standardized placeholder value instead of the literal 'test'; locate the call chain in the H1 test (method testRenderWithRemoveDataAttribute) where H1::tag()->addDataAttribute('value', 'test') is used and replace the second argument with the placeholder 'value' so it matches the other tests that use ->addDataAttribute('value', 'value')->removeDataAttribute('value')->render().tests/Form/InputUrlTest.php (1)
300-309:⚠️ Potential issue | 🟡 MinorUse
attributes()intestRenderWithAttributesto avoid duplicate coverage.
testRenderWithAttributescurrently callsclass('value'), which is already covered bytestRenderWithClass. Switching toattributes(['class' => 'value'])(or renaming the test/message) keeps the test aligned with the method under test.🛠️ Suggested fix
- InputUrl::tag() - ->class('value') + InputUrl::tag() + ->attributes(['class' => 'value']) ->id('inputurl') ->render(),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Form/InputUrlTest.php` around lines 300 - 309, The test testRenderWithAttributes duplicates coverage of class() from testRenderWithClass; update the test to call InputUrl::tag()->attributes(['class' => 'value'])->id('inputurl')->render() instead of ->class('value') so it exercises the attributes() path (or alternatively rename the test/message to reflect it's covering class()), referencing the test method testRenderWithAttributes and the InputUrl::tag(), class(), attributes() usage.tests/Metadata/MetaTest.php (1)
10-20:⚠️ Potential issue | 🔴 CriticalAdd missing
CharsetandHttpEquivenums andHasCharset/HttpEquivtrait implementations.Tests import and use
Charset::UTF_8andHttpEquiv::REFRESHenums, and theMetaclass declares it usesHasCharsetandHasHttpEquivtraits, but none of these exist in production code (src/). TheUIAwesome\Html\Attribute\Values\namespace andUIAwesome\Html\Attribute\directory are missing entirely. These must be implemented insrc/for tests to pass and avoid import errors on branches containing only test changes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Metadata/MetaTest.php` around lines 10 - 20, Tests reference missing enums and traits: add the UIAwesome\Html\Attribute\Values\Charset enum with at least a UTF_8 value and the HttpEquiv enum with at least a REFRESH value, and create the HasCharset and HasHttpEquiv traits used by the Meta class to expose/get/set those attributes; place these under the UIAwesome\Html\Attribute\Values and UIAwesome\Html\Attribute namespaces respectively so imports like Charset::UTF_8, HttpEquiv::REFRESH, HasCharset, HasHttpEquiv and the Meta class resolve correctly, and ensure trait method names/signatures match how Meta uses them.tests/Form/InputEmailTest.php (1)
251-266:⚠️ Potential issue | 🟡 MinorUse
ariaAttributes()in the aria-attributes test.The test name/message indicate
ariaAttributes(), but the current code callsattributes()with fullaria-*keys, so the intended API isn’t covered.🛠️ Suggested fix
- InputEmail::tag() - ->attributes( - [ - 'aria-controls' => 'value', - 'aria-label' => 'value', - ], - ) + InputEmail::tag() + ->ariaAttributes( + [ + 'controls' => 'value', + 'label' => 'value', + ], + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Form/InputEmailTest.php` around lines 251 - 266, The test testRenderWithAriaAttributes currently calls InputEmail::tag()->attributes([...]) with aria-* keys but should exercise the ariaAttributes() API; update the assertion setup to call InputEmail::tag()->ariaAttributes(['controls' => 'value','label' => 'value']) (or use the exact method signature of ariaAttributes on the InputEmail tag) then ->id('inputemail')->render() so the test validates the intended ariaAttributes() behavior instead of generic attributes().tests/Heading/H5Test.php (1)
527-540: 🧹 Nitpick | 🔵 TrivialNit:
'test'is inconsistent with the standardized'value'placeholder used across all other tests in this PR.Since the attribute is removed immediately the result is identical, but the value deviates from the uniform
'value'placeholder established by this PR.♻️ Suggested fix
- ->addDataAttribute('value', 'test') + ->addDataAttribute('value', 'value')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Heading/H5Test.php` around lines 527 - 540, Update the test testRenderWithRemoveDataAttribute so the placeholder value passed to H5::tag()->addDataAttribute(...) matches the standardized 'value' used elsewhere; specifically change the literal 'test' used in the call to addDataAttribute('value', 'test') to 'value' (i.e., addDataAttribute('value', 'value')), leaving removeDataAttribute('value') and the rest of the assertion unchanged.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (59)
CHANGELOG.mdtests/Embedded/ImgTest.phptests/Flow/DivTest.phptests/Flow/HrTest.phptests/Flow/MainTest.phptests/Flow/PTest.phptests/Form/InputCheckboxTest.phptests/Form/InputDateTimeLocalTest.phptests/Form/InputEmailTest.phptests/Form/InputFileTest.phptests/Form/InputHiddenTest.phptests/Form/InputImageTest.phptests/Form/InputMonthTest.phptests/Form/InputNumberTest.phptests/Form/InputPasswordTest.phptests/Form/InputRadioTest.phptests/Form/InputRangeTest.phptests/Form/InputResetTest.phptests/Form/InputSearchTest.phptests/Form/InputSubmitTest.phptests/Form/InputTelTest.phptests/Form/InputTextTest.phptests/Form/InputTimeTest.phptests/Form/InputUrlTest.phptests/Form/InputWeekTest.phptests/Heading/H1Test.phptests/Heading/H2Test.phptests/Heading/H3Test.phptests/Heading/H4Test.phptests/Heading/H5Test.phptests/Heading/H6Test.phptests/Heading/HGroupTest.phptests/List/DdTest.phptests/List/DlTest.phptests/List/DtTest.phptests/List/LiTest.phptests/List/OlTest.phptests/List/UlTest.phptests/Metadata/BaseTest.phptests/Metadata/LinkTest.phptests/Metadata/MetaTest.phptests/Metadata/NoScriptTest.phptests/Metadata/ScriptTest.phptests/Metadata/StyleTest.phptests/Metadata/TemplateTest.phptests/Metadata/TitleTest.phptests/Palpable/ATest.phptests/Phrasing/ITest.phptests/Phrasing/LabelTest.phptests/Phrasing/SpanTest.phptests/Root/BodyTest.phptests/Root/FooterTest.phptests/Root/HeadTest.phptests/Root/HeaderTest.phptests/Root/HtmlTest.phptests/Sectioning/ArticleTest.phptests/Sectioning/AsideTest.phptests/Sectioning/NavTest.phptests/Sectioning/SectionTest.php
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: terabytesoftw
Repo: ui-awesome/html PR: 24
File: tests/Form/InputTextTest.php:33-620
Timestamp: 2026-02-06T21:37:51.711Z
Learning: In the ui-awesome/html repository, prefer individual test methods over PHPUnit data providers in test classes. The maintainer values the ability to see exactly how each test works without needing to cross-reference data providers, even if it results in more methods.
Learnt from: terabytesoftw
Repo: ui-awesome/html PR: 35
File: tests/Provider/Form/CheckedProvider.php:13-14
Timestamp: 2026-02-09T11:28:09.334Z
Learning: In the ui-awesome/html repository, using `str_replace` to adapt shared data provider HTML strings for different input types (e.g., adapting `CheckedProvider` for both `InputCheckboxTest` and `InputRadioTest` by replacing "inputcheckbox-" with "inputradio-" and "checkbox" with "radio") is acceptable and considered clear. Don't suggest refactoring such patterns to avoid string replacement.
Learnt from: terabytesoftw
Repo: ui-awesome/html PR: 37
File: tests/Form/InputTextTest.php:448-457
Timestamp: 2026-02-11T14:56:26.855Z
Learning: In the ui-awesome/html repository, short variable names (e.g., 2-character names like `$id`) are acceptable in test files and should not be flagged. PHPMD's short-variable rule does not need to be strictly followed in test code.
📚 Learning: 2026-02-06T21:37:44.509Z
Learnt from: terabytesoftw
Repo: ui-awesome/html PR: 24
File: tests/Form/InputTextTest.php:33-620
Timestamp: 2026-02-06T21:37:44.509Z
Learning: In the ui-awesome/html repository, prefer individual test methods over PHPUnit data providers in test classes. This helps maintainers see exactly how each test behaves without cross-referencing data providers. Apply to all PHP test files under tests. Use separate, descriptively named test methods to cover different inputs/edge cases; retain data providers only if they clearly improve readability or reduce duplication.
Applied to files:
tests/Root/HtmlTest.phptests/Heading/HGroupTest.phptests/Form/InputSubmitTest.phptests/List/UlTest.phptests/List/DdTest.phptests/Sectioning/NavTest.phptests/Flow/MainTest.phptests/Form/InputImageTest.phptests/Form/InputRangeTest.phptests/Metadata/TitleTest.phptests/Sectioning/AsideTest.phptests/Form/InputTimeTest.phptests/Heading/H1Test.phptests/Metadata/NoScriptTest.phptests/Heading/H4Test.phptests/Form/InputPasswordTest.phptests/Root/BodyTest.phptests/Form/InputFileTest.phptests/Form/InputWeekTest.phptests/Form/InputTelTest.phptests/Heading/H5Test.phptests/Metadata/MetaTest.phptests/Form/InputTextTest.phptests/Phrasing/ITest.phptests/Heading/H6Test.phptests/Form/InputNumberTest.phptests/Heading/H2Test.phptests/Form/InputCheckboxTest.phptests/Flow/PTest.phptests/List/DtTest.phptests/List/DlTest.phptests/List/OlTest.phptests/Metadata/BaseTest.phptests/Metadata/ScriptTest.phptests/Form/InputEmailTest.phptests/Sectioning/SectionTest.phptests/Flow/HrTest.phptests/List/LiTest.phptests/Metadata/TemplateTest.phptests/Root/HeaderTest.phptests/Form/InputMonthTest.phptests/Root/FooterTest.phptests/Phrasing/LabelTest.phptests/Phrasing/SpanTest.phptests/Root/HeadTest.phptests/Form/InputDateTimeLocalTest.phptests/Form/InputHiddenTest.phptests/Sectioning/ArticleTest.phptests/Form/InputSearchTest.phptests/Flow/DivTest.phptests/Embedded/ImgTest.phptests/Form/InputUrlTest.phptests/Form/InputResetTest.phptests/Metadata/LinkTest.phptests/Form/InputRadioTest.phptests/Palpable/ATest.phptests/Heading/H3Test.phptests/Metadata/StyleTest.php
📚 Learning: 2026-02-09T11:28:09.334Z
Learnt from: terabytesoftw
Repo: ui-awesome/html PR: 35
File: tests/Provider/Form/CheckedProvider.php:13-14
Timestamp: 2026-02-09T11:28:09.334Z
Learning: In the ui-awesome/html repository, using `str_replace` to adapt shared data provider HTML strings for different input types (e.g., adapting `CheckedProvider` for both `InputCheckboxTest` and `InputRadioTest` by replacing "inputcheckbox-" with "inputradio-" and "checkbox" with "radio") is acceptable and considered clear. Don't suggest refactoring such patterns to avoid string replacement.
Applied to files:
tests/Root/HtmlTest.phptests/Form/InputSubmitTest.phptests/Form/InputImageTest.phptests/Form/InputRangeTest.phptests/Form/InputTimeTest.phptests/Form/InputFileTest.phptests/Form/InputWeekTest.phptests/Form/InputTelTest.phptests/Form/InputTextTest.phptests/Form/InputNumberTest.phptests/Form/InputCheckboxTest.phptests/Metadata/BaseTest.phptests/Form/InputEmailTest.phptests/Form/InputMonthTest.phptests/Form/InputDateTimeLocalTest.phptests/Form/InputHiddenTest.phptests/Form/InputSearchTest.phptests/Form/InputUrlTest.phptests/Form/InputResetTest.phptests/Form/InputRadioTest.php
📚 Learning: 2026-02-11T14:56:18.277Z
Learnt from: terabytesoftw
Repo: ui-awesome/html PR: 37
File: tests/Form/InputTextTest.php:448-457
Timestamp: 2026-02-11T14:56:18.277Z
Learning: In PHP test files under the repository ui-awesome/html (e.g., tests/Form/InputTextTest.php), it is acceptable to use short variable names (e.g., 2-character names like $id). PHPMD's short-variable rule does not need to be strictly followed in test code. During reviews, allow short names in test files and note that this relaxed style applies to tests, while production code should adhere to the standard variable naming conventions.
Applied to files:
tests/Root/HtmlTest.phptests/Heading/HGroupTest.phptests/Form/InputSubmitTest.phptests/List/UlTest.phptests/List/DdTest.phptests/Sectioning/NavTest.phptests/Flow/MainTest.phptests/Form/InputImageTest.phptests/Form/InputRangeTest.phptests/Metadata/TitleTest.phptests/Sectioning/AsideTest.phptests/Form/InputTimeTest.phptests/Heading/H1Test.phptests/Metadata/NoScriptTest.phptests/Heading/H4Test.phptests/Form/InputPasswordTest.phptests/Root/BodyTest.phptests/Form/InputFileTest.phptests/Form/InputWeekTest.phptests/Form/InputTelTest.phptests/Heading/H5Test.phptests/Metadata/MetaTest.phptests/Form/InputTextTest.phptests/Phrasing/ITest.phptests/Heading/H6Test.phptests/Form/InputNumberTest.phptests/Heading/H2Test.phptests/Form/InputCheckboxTest.phptests/Flow/PTest.phptests/List/DtTest.phptests/List/DlTest.phptests/List/OlTest.phptests/Metadata/BaseTest.phptests/Metadata/ScriptTest.phptests/Form/InputEmailTest.phptests/Sectioning/SectionTest.phptests/Flow/HrTest.phptests/List/LiTest.phptests/Metadata/TemplateTest.phptests/Root/HeaderTest.phptests/Form/InputMonthTest.phptests/Root/FooterTest.phptests/Phrasing/LabelTest.phptests/Phrasing/SpanTest.phptests/Root/HeadTest.phptests/Form/InputDateTimeLocalTest.phptests/Form/InputHiddenTest.phptests/Sectioning/ArticleTest.phptests/Form/InputSearchTest.phptests/Flow/DivTest.phptests/Embedded/ImgTest.phptests/Form/InputUrlTest.phptests/Form/InputResetTest.phptests/Metadata/LinkTest.phptests/Form/InputRadioTest.phptests/Palpable/ATest.phptests/Heading/H3Test.phptests/Metadata/StyleTest.php
📚 Learning: 2026-02-07T18:51:41.006Z
Learnt from: terabytesoftw
Repo: ui-awesome/html PR: 31
File: src/Form/Mixin/HasLabel.php:195-195
Timestamp: 2026-02-07T18:51:41.006Z
Learning: In the ui-awesome/html repository, explicit boolean comparisons (e.g., `isset($var) === false`) are required instead of negation operators (e.g., `!isset($var)`) due to PHPStan strict rules configuration at the highest level.
Applied to files:
tests/Metadata/MetaTest.phptests/Form/InputCheckboxTest.phptests/Metadata/BaseTest.phptests/Form/InputDateTimeLocalTest.phptests/Metadata/LinkTest.php
🧬 Code graph analysis (49)
tests/Heading/HGroupTest.php (2)
src/Heading/HGroup.php (1)
HGroup(29-42)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Form/InputSubmitTest.php (3)
src/Form/InputSubmit.php (1)
InputSubmit(37-80)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)src/Form/Attribute/HasFormtarget.php (1)
formtarget(34-37)
tests/List/UlTest.php (1)
src/List/Ul.php (3)
Ul(28-94)items(46-55)li(72-81)
tests/List/DdTest.php (2)
src/List/Dd.php (1)
Dd(26-39)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Sectioning/NavTest.php (1)
src/Sectioning/Nav.php (1)
Nav(27-40)
tests/Flow/MainTest.php (13)
src/Flow/Main.php (1)
Main(27-40)tests/Form/InputCheckboxTest.php (1)
testRenderWithClassUsingEnum(396-408)tests/Form/InputHiddenTest.php (1)
testRenderWithClassUsingEnum(380-392)tests/Form/InputNumberTest.php (1)
testRenderWithClassUsingEnum(396-408)tests/Form/InputPasswordTest.php (1)
testRenderWithClassUsingEnum(397-409)tests/Form/InputRadioTest.php (1)
testRenderWithClassUsingEnum(405-417)tests/Form/InputRangeTest.php (1)
testRenderWithClassUsingEnum(395-407)tests/Form/InputResetTest.php (1)
testRenderWithClassUsingEnum(357-369)tests/Form/InputSearchTest.php (1)
testRenderWithClassUsingEnum(394-406)tests/Form/InputSubmitTest.php (1)
testRenderWithClassUsingEnum(357-369)tests/Form/InputTelTest.php (1)
testRenderWithClassUsingEnum(396-408)tests/Form/InputTextTest.php (1)
testRenderWithClassUsingEnum(398-410)tests/Form/InputWeekTest.php (1)
testRenderWithClassUsingEnum(398-410)
tests/Form/InputImageTest.php (4)
src/Form/InputImage.php (1)
InputImage(41-86)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)src/Form/Attribute/HasFormtarget.php (1)
formtarget(34-37)tests/Embedded/ImgTest.php (1)
testRenderWithSrc(684-695)
tests/Metadata/TitleTest.php (2)
src/Metadata/Title.php (1)
Title(26-39)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Sectioning/AsideTest.php (2)
src/Sectioning/Aside.php (1)
Aside(27-40)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Heading/H1Test.php (2)
src/Heading/H1.php (1)
H1(27-40)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Metadata/NoScriptTest.php (1)
src/Metadata/NoScript.php (1)
NoScript(26-39)
tests/Heading/H4Test.php (2)
src/Heading/H4.php (1)
H4(27-40)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Root/BodyTest.php (4)
src/Root/Body.php (1)
Body(27-40)tests/Root/HtmlTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Flow/MainTest.php (2)
testGetAttributesReturnsAssignedAttributes(60-69)testRenderWithSetAttribute(600-612)
tests/Form/InputFileTest.php (2)
src/Form/InputFile.php (2)
InputFile(43-139)getAttributes(61-70)src/Form/Attribute/HasCapture.php (1)
capture(35-38)
tests/Form/InputWeekTest.php (2)
src/Form/InputWeek.php (1)
InputWeek(51-96)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)
tests/Form/InputTelTest.php (2)
src/Form/InputTel.php (1)
InputTel(46-94)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)
tests/Heading/H5Test.php (5)
src/Heading/H5.php (1)
H5(27-40)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Heading/H1Test.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Heading/H2Test.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Heading/H3Test.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)
tests/Metadata/MetaTest.php (1)
src/Metadata/Meta.php (1)
Meta(28-47)
tests/Form/InputTextTest.php (2)
src/Form/InputText.php (1)
InputText(45-94)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)
tests/Phrasing/ITest.php (4)
src/Phrasing/I.php (1)
I(27-50)tests/Embedded/ImgTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(645-656)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Phrasing/SpanTest.php (2)
testGetAttributesReturnsAssignedAttributes(57-66)testRenderWithSetAttribute(461-472)
tests/Heading/H6Test.php (2)
src/Heading/H6.php (1)
H6(27-40)tests/Heading/H1Test.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)
tests/Form/InputNumberTest.php (2)
src/Form/InputNumber.php (1)
InputNumber(44-90)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)
tests/Heading/H2Test.php (1)
src/Heading/H2.php (1)
H2(27-40)
tests/Form/InputCheckboxTest.php (4)
src/Root/Html.php (1)
Html(27-40)src/Form/InputCheckbox.php (1)
InputCheckbox(31-57)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)src/Form/Mixin/CanBeEnclosedByLabel.php (1)
enclosedByLabel(32-38)
tests/Flow/PTest.php (4)
src/Flow/P.php (1)
P(27-40)tests/Form/InputTelTest.php (1)
testRenderWithClassUsingEnum(396-408)tests/Form/InputTextTest.php (1)
testRenderWithClassUsingEnum(398-410)tests/Form/InputWeekTest.php (1)
testRenderWithClassUsingEnum(398-410)
tests/List/DtTest.php (4)
src/List/Dt.php (1)
Dt(26-39)tests/Embedded/ImgTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(645-656)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Heading/H1Test.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)
tests/List/DlTest.php (4)
tests/Embedded/ImgTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(645-656)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Flow/PTest.php (2)
testGetAttributesReturnsAssignedAttributes(60-69)testRenderWithSetAttribute(600-612)tests/Heading/H1Test.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)
tests/List/OlTest.php (3)
src/List/Ol.php (3)
Ol(31-100)items(52-61)li(78-87)src/List/Ul.php (2)
items(46-55)li(72-81)src/List/Attribute/HasReversed.php (1)
reversed(30-33)
tests/Metadata/ScriptTest.php (1)
src/Metadata/Script.php (1)
Script(37-61)
tests/Form/InputEmailTest.php (1)
src/Form/InputEmail.php (1)
InputEmail(47-96)
tests/Sectioning/SectionTest.php (2)
src/Sectioning/Section.php (1)
Section(27-40)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Flow/HrTest.php (4)
tests/Heading/H1Test.php (1)
testGetAttributesReturnsAssignedAttributes(59-68)src/Root/Html.php (1)
Html(27-40)src/Flow/Hr.php (1)
Hr(26-39)tests/Form/InputTextTest.php (1)
testRenderWithClassUsingEnum(398-410)
tests/Metadata/TemplateTest.php (6)
src/Metadata/Template.php (1)
Template(33-52)tests/Root/HtmlTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Embedded/ImgTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(645-656)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Flow/MainTest.php (2)
testGetAttributesReturnsAssignedAttributes(60-69)testRenderWithSetAttribute(600-612)src/Metadata/Attribute/HasShadowRootReferenceTarget.php (1)
shadowRootReferenceTarget(35-38)
tests/Root/HeaderTest.php (5)
src/Root/Header.php (1)
Header(27-40)tests/Root/FooterTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Root/HtmlTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Flow/MainTest.php (2)
testGetAttributesReturnsAssignedAttributes(60-69)testRenderWithSetAttribute(600-612)
tests/Form/InputMonthTest.php (2)
src/Form/InputMonth.php (1)
InputMonth(52-97)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)
tests/Root/FooterTest.php (1)
src/Root/Footer.php (1)
Footer(27-40)
tests/Phrasing/LabelTest.php (1)
src/Phrasing/Label.php (2)
Label(27-68)for(42-45)
tests/Phrasing/SpanTest.php (2)
src/Phrasing/Span.php (1)
Span(27-50)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Root/HeadTest.php (5)
src/Root/Head.php (1)
Head(26-39)tests/Root/FooterTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Root/HtmlTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)tests/Flow/MainTest.php (2)
testGetAttributesReturnsAssignedAttributes(60-69)testRenderWithSetAttribute(600-612)
tests/Form/InputDateTimeLocalTest.php (2)
src/Form/InputDateTimeLocal.php (1)
InputDateTimeLocal(51-96)tests/Form/InputRadioTest.php (1)
testGetAttributesReturnsAssignedAttributes(48-62)
tests/Form/InputSearchTest.php (2)
src/Form/InputSearch.php (1)
InputSearch(49-98)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)
tests/Flow/DivTest.php (15)
src/Flow/Div.php (1)
Div(27-40)tests/Flow/MainTest.php (2)
testGetAttributesReturnsAssignedAttributes(60-69)testRenderWithClassUsingEnum(244-256)tests/Heading/H1Test.php (1)
testGetAttributesReturnsAssignedAttributes(59-68)tests/Form/InputCheckboxTest.php (1)
testRenderWithClassUsingEnum(396-408)tests/Form/InputHiddenTest.php (1)
testRenderWithClassUsingEnum(380-392)tests/Form/InputNumberTest.php (1)
testRenderWithClassUsingEnum(396-408)tests/Form/InputPasswordTest.php (1)
testRenderWithClassUsingEnum(397-409)tests/Form/InputRadioTest.php (1)
testRenderWithClassUsingEnum(405-417)tests/Form/InputRangeTest.php (1)
testRenderWithClassUsingEnum(395-407)tests/Form/InputResetTest.php (1)
testRenderWithClassUsingEnum(357-369)tests/Form/InputSearchTest.php (1)
testRenderWithClassUsingEnum(394-406)tests/Form/InputSubmitTest.php (1)
testRenderWithClassUsingEnum(357-369)tests/Form/InputTelTest.php (1)
testRenderWithClassUsingEnum(396-408)tests/Form/InputTextTest.php (1)
testRenderWithClassUsingEnum(398-410)tests/Form/InputWeekTest.php (1)
testRenderWithClassUsingEnum(398-410)
tests/Embedded/ImgTest.php (3)
src/Embedded/Img.php (1)
Img(43-71)tests/Form/InputTextTest.php (1)
testRenderWithClassUsingEnum(398-410)src/Embedded/Attribute/HasElementtiming.php (1)
elementtiming(34-37)
tests/Form/InputUrlTest.php (2)
src/Form/InputUrl.php (1)
InputUrl(46-94)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)
tests/Form/InputResetTest.php (1)
src/Form/InputReset.php (1)
InputReset(30-67)
tests/Form/InputRadioTest.php (3)
src/Form/InputRadio.php (1)
InputRadio(31-57)src/Form/Base/BaseChoice.php (1)
getAttributes(48-51)src/Form/Mixin/CanBeEnclosedByLabel.php (1)
enclosedByLabel(32-38)
tests/Palpable/ATest.php (4)
src/Palpable/A.php (1)
A(37-69)tests/Metadata/LinkTest.php (1)
testRenderWithTypeUsingEnum(811-822)tests/Metadata/ScriptTest.php (1)
testRenderWithTypeUsingEnum(942-954)tests/Metadata/StyleTest.php (1)
testRenderWithTypeUsingEnum(812-824)
tests/Heading/H3Test.php (2)
tests/Root/HtmlTest.php (2)
testGetAttributesReturnsAssignedAttributes(59-68)testRenderWithSetAttribute(585-597)tests/Flow/HrTest.php (2)
testGetAttributesReturnsAssignedAttributes(39-48)testRenderWithSetAttribute(430-441)
tests/Metadata/StyleTest.php (4)
src/Metadata/Style.php (1)
Style(28-46)tests/Metadata/LinkTest.php (1)
testRenderWithTypeUsingEnum(811-822)tests/Metadata/ScriptTest.php (1)
testRenderWithTypeUsingEnum(942-954)tests/Palpable/ATest.php (1)
testRenderWithTypeUsingEnum(743-754)
🪛 PHPMD (2.15.0)
tests/Form/InputTimeTest.php
[error] 986-992: Avoid using static access to class '\UIAwesome\Html\Core\Factory\SimpleFactory' in method 'testRenderWithUserOverridesGlobalDefaults'. (undefined)
(StaticAccess)
tests/Metadata/NoScriptTest.php
[error] 224-224: Avoid using static access to class '\UIAwesome\Html\Metadata\NoScript' in method 'testRenderWithBeginEnd'. (undefined)
(StaticAccess)
tests/Metadata/MetaTest.php
[error] 651-651: Avoid using static access to class '\UIAwesome\Html\Helper\Enum' in method 'testThrowInvalidArgumentExceptionForSettingHttpEquiv'. (undefined)
(StaticAccess)
[error] 651-651: Avoid using static access to class '\UIAwesome\Html\Attribute\Values\HttpEquiv' in method 'testThrowInvalidArgumentExceptionForSettingHttpEquiv'. (undefined)
(StaticAccess)
tests/Metadata/ScriptTest.php
[error] 249-249: Avoid using static access to class '\UIAwesome\Html\Metadata\Script' in method 'testRenderWithBeginEnd'. (undefined)
(StaticAccess)
tests/Form/InputUrlTest.php
[error] 1000-1006: Avoid using static access to class '\UIAwesome\Html\Core\Factory\SimpleFactory' in method 'testRenderWithUserOverridesGlobalDefaults'. (undefined)
(StaticAccess)
[error] 1016-1019: Avoid using static access to class '\UIAwesome\Html\Core\Factory\SimpleFactory' in method 'testRenderWithUserOverridesGlobalDefaults'. (undefined)
(StaticAccess)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: phpunit / PHP 8.4-ubuntu-latest
- GitHub Check: linter / Super Linter
- GitHub Check: linter / Super Linter
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/Form/InputDateTimeLocalTest.php`:
- Around line 900-914: The assertion message in testRenderWithTemplate is
misleading; update the failure message passed to assertSame in the test method
testRenderWithTemplate to accurately describe what's being tested (e.g., that
the element renders correctly with a custom wrapper template) by editing the
message string after InputDateTimeLocal::tag()->template(...)->render() to
remove "enclosed label" and reflect the custom template behavior.
In `@tests/Form/InputResetTest.php`:
- Around line 734-748: The assertion message in the testRenderWithTemplate test
is misleading; update the final assertion message string (in the
testRenderWithTemplate method that calls
InputReset::tag()->id('inputreset')->template(...)->render()) to accurately
describe this test (e.g., "Failed asserting that element renders correctly with
custom template." or similar) so it no longer references an enclosed label; keep
the rest of the assertion unchanged.
In `@tests/Form/InputSearchTest.php`:
- Around line 925-939: Update the failing assertion message in the
testRenderWithTemplate method to accurately describe what's being tested:
replace the misleading text "'Failed asserting that element renders correctly
with enclosed label and custom template.'" with a message that references the
custom template (e.g., "'Failed asserting that element renders correctly with
custom template.'") so it no longer mentions a label; locate the assertion
inside testRenderWithTemplate that compares the heredoc HTML to
InputSearch::tag()->id('inputsearch')->template(...)->render() and change only
the message string.
In `@tests/List/UlTest.php`:
- Around line 282-283: The failure message for the test methods named like
testRenderWith*UsingEnum currently duplicates their non-enum siblings; update
each assertSame call in the testRenderWith*UsingEnum methods (the ones at the
pairs mentioned) to include a distinguishing phrase such as "using enum" (e.g.,
change "Failed asserting that element renders correctly with 'contentEditable'
attribute." to "Failed asserting that element renders correctly with
'contentEditable' attribute (using enum)." ) so each *UsingEnum test has a
unique assertion message for faster triage; apply the same pattern to all
affected testRenderWith*UsingEnum methods referenced in the comment.
---
Outside diff comments:
In `@tests/Form/InputEmailTest.php`:
- Around line 251-266: The test testRenderWithAriaAttributes currently calls
InputEmail::tag()->attributes([...]) with aria-* keys but should exercise the
ariaAttributes() API; update the assertion setup to call
InputEmail::tag()->ariaAttributes(['controls' => 'value','label' => 'value'])
(or use the exact method signature of ariaAttributes on the InputEmail tag) then
->id('inputemail')->render() so the test validates the intended ariaAttributes()
behavior instead of generic attributes().
In `@tests/Form/InputResetTest.php`:
- Around line 535-546: The test testRenderWithId duplicates
testRenderWithDefaultValues because it sets ->id('inputreset') which matches the
default output; change the id value used in testRenderWithId to a non-default
(e.g., 'value') and update the expected HEREDOC to "<input id=\"value\"
type=\"reset\">" so InputReset::tag()->id('value')->render() is asserted against
a distinct output from testRenderWithDefaultValues.
In `@tests/Form/InputUrlTest.php`:
- Around line 300-309: The test testRenderWithAttributes duplicates coverage of
class() from testRenderWithClass; update the test to call
InputUrl::tag()->attributes(['class' => 'value'])->id('inputurl')->render()
instead of ->class('value') so it exercises the attributes() path (or
alternatively rename the test/message to reflect it's covering class()),
referencing the test method testRenderWithAttributes and the InputUrl::tag(),
class(), attributes() usage.
In `@tests/Heading/H1Test.php`:
- Around line 527-540: Update the testRenderWithRemoveDataAttribute unit test to
use the standardized placeholder value instead of the literal 'test'; locate the
call chain in the H1 test (method testRenderWithRemoveDataAttribute) where
H1::tag()->addDataAttribute('value', 'test') is used and replace the second
argument with the placeholder 'value' so it matches the other tests that use
->addDataAttribute('value', 'value')->removeDataAttribute('value')->render().
In `@tests/Heading/H3Test.php`:
- Around line 527-540: The test testRenderWithRemoveDataAttribute uses the
literal 'test' for the data attribute value instead of the standardized 'value'
placeholder; update the H3 test to call H3::tag()->addDataAttribute('value',
'value')->removeDataAttribute('value')->render() (i.e., replace the second
argument 'test' with 'value') so the test matches the suite-wide standard while
keeping the same call sequence to addDataAttribute and removeDataAttribute.
In `@tests/Heading/H5Test.php`:
- Around line 527-540: Update the test testRenderWithRemoveDataAttribute so the
placeholder value passed to H5::tag()->addDataAttribute(...) matches the
standardized 'value' used elsewhere; specifically change the literal 'test' used
in the call to addDataAttribute('value', 'test') to 'value' (i.e.,
addDataAttribute('value', 'value')), leaving removeDataAttribute('value') and
the rest of the assertion unchanged.
In `@tests/List/LiTest.php`:
- Around line 498-511: testRenderWithoutValue is now a duplicate of
testRenderWithContent; restore its original distinct intent by changing the test
to render a bare Li::tag() with no content or value attribute and assert the
empty <li> output (i.e. call Li::tag()->render() instead of ->content('value'))
so it verifies rendering without a value attribute rather than duplicating
testRenderWithContent.
In `@tests/List/OlTest.php`:
- Around line 404-424: The test testRenderWithGlobalDefaultsAreApplied sets
global defaults via SimpleFactory::setDefaults(Ol::class, ...) but resets them
unguarded at the end, which can leave global state dirty if the assertion fails;
wrap the assertion and any code that relies on the defaults in a try/finally and
move the trailing SimpleFactory::setDefaults(Ol::class, []) into the finally
block so the reset always runs even on assertion failures (apply the same
pattern to the other affected tests mentioned).
- Around line 273-285: Update the failure messages for the enum-based tests so
they indicate the enum code path: change the assertion messages in
testRenderWithContentEditableUsingEnum, testRenderWithDirUsingEnum,
testRenderWithDraggableUsingEnum, testRenderWithLangUsingEnum,
testRenderWithRoleUsingEnum, testRenderWithSetAttributeUsingEnum, and
testRenderWithTranslateUsingEnum to include "using enum" or "UsingEnum" (e.g.,
"Failed asserting that element renders correctly with 'contentEditable'
attribute using enum.") so failures clearly distinguish the enum variant from
the scalar variant.
In `@tests/Metadata/MetaTest.php`:
- Around line 10-20: Tests reference missing enums and traits: add the
UIAwesome\Html\Attribute\Values\Charset enum with at least a UTF_8 value and the
HttpEquiv enum with at least a REFRESH value, and create the HasCharset and
HasHttpEquiv traits used by the Meta class to expose/get/set those attributes;
place these under the UIAwesome\Html\Attribute\Values and
UIAwesome\Html\Attribute namespaces respectively so imports like Charset::UTF_8,
HttpEquiv::REFRESH, HasCharset, HasHttpEquiv and the Meta class resolve
correctly, and ensure trait method names/signatures match how Meta uses them.
In `@tests/Metadata/StyleTest.php`:
- Around line 851-875: The test testReturnNewInstanceWhenSettingAttribute uses
Style::blocking('') which throws InvalidArgumentException because '' is not a
valid Blocking enum case; change the call to use a known-valid enum value (e.g.
Blocking::RENDER) so Style::blocking(...) returns a new instance instead of
throwing; update the assertion that calls $style->blocking(...) and
import/reference the Blocking enum where needed while leaving the other
assertions (media, nonce, type) unchanged.
In `@tests/Phrasing/LabelTest.php`:
- Around line 502-513: The test expectation in testRenderWithStyle is using
single quotes for the style attribute which is inconsistent with the renderer's
double-quoted output; update the expected HTML string in testRenderWithStyle
(the assertion comparing the heredoc to Label::tag()->style('value')->render())
to use double quotes for the style attribute: change "<label
style='value'></label>" to "<label style=\"value\"></label>" so the expected
string matches the renderer's format.
Pull Request