fix(tests): Add tests for invalid argument exceptions in HTML attributes.#58
fix(tests): Add tests for invalid argument exceptions in HTML attributes.#58terabytesoftw merged 3 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 169 169
===========================================
Files 88 88
Lines 356 356
===========================================
Hits 356 356 ☔ View full report in Codecov by Sentry. |
|
No actionable comments were generated in the recent review. 🎉 📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2026-02-22T19:26:33.769ZApplied to files:
⏰ 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). (16)
🔇 Additional comments (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds one changelog entry, reformats PHPDoc usage examples in a few attribute classes, and introduces extensive negative-path unit tests across many element/test files that assert InvalidArgumentException messages for invalid HTML attribute values. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Possibly related PRs
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: 20
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/Form/Attribute/HasFormaction.php (1)
14-14:⚠️ Potential issue | 🟡 MinorUpdate the
@linkURL to point to a valid MDN page.The current URL
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/formactionreturns a 404 error. Theformactionattribute documentation is located on the element reference pages (e.g.,input,button).Update to:
- * `@link` https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/formaction + * `@link` https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#formaction🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Form/Attribute/HasFormaction.php` at line 14, The `@link` in the HasFormaction.php docblock points to a 404; update the URL to MDN's valid anchor for the formaction attribute (for example use "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formaction" or the equivalent button element anchor). Edit the docblock in src/Form/Attribute/HasFormaction.php to replace the invalid link with the correct MDN element anchor (keep the rest of the docblock unchanged and ensure the link targets the formaction attribute anchor).tests/Metadata/MetaTest.php (1)
645-713: 🧹 Nitpick | 🔵 TrivialAvoid duplicating trait-level validation tests.
These invalid-argument tests cover global-attribute trait validation rather than Meta-specific integration. Consider removing them here (or replacing with a single integration smoke check) and rely on the html-attribute trait tests for validation behavior.
Based on learnings: In the ui-awesome/html repository, when a class uses traits from the html-attribute package (e.g., HasType, HasForm), do not add tests that exercise trait-specific validation or null-handling behavior. Those aspects are already comprehensively tested in the html-attribute package (e.g., HasTypeTest.php, TypeProvider.php). Focus on tests that cover the class-specific integration and rendering.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Metadata/MetaTest.php` around lines 645 - 713, Remove the duplicated trait-level validation tests from MetaTest: delete the methods testThrowInvalidArgumentExceptionWhenSettingDir, testThrowInvalidArgumentExceptionWhenSettingHttpEquiv, testThrowInvalidArgumentExceptionWhenSettingLang, testThrowInvalidArgumentExceptionWhenSettingRole, and testThrowInvalidArgumentExceptionWhenSettingTranslate (these exercise global-attribute trait validation already covered in the html-attribute package); alternatively replace them with a single lightweight integration/smoke test that ensures Meta::tag() accepts valid values and renders without delegating to trait-level validation (e.g., call Meta::tag()->dir('ltr')->render() and assert output contains the attribute) so Meta-specific behavior is covered but trait validation remains tested in the trait package.tests/Metadata/LinkTest.php (1)
877-959: 🧹 Nitpick | 🔵 TrivialAvoid duplicating trait-level validation tests.
These invalid-argument tests are for global-attribute trait validation rather than Link-specific integration. Consider removing them here (or collapsing to a minimal integration smoke test) and rely on the html-attribute trait tests for validation coverage.
Based on learnings: In the ui-awesome/html repository, when a class uses traits from the html-attribute package (e.g., HasType, HasForm), do not add tests that exercise trait-specific validation or null-handling behavior. Those aspects are already comprehensively tested in the html-attribute package (e.g., HasTypeTest.php, TypeProvider.php). Focus on tests that cover the class-specific integration and rendering.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Metadata/LinkTest.php` around lines 877 - 959, These tests duplicate trait-level validation covered by the html-attribute package; remove the individual invalid-argument tests in LinkTest that call Link::tag()->dir('invalid-value'), ->fetchpriority('invalid-value'), ->lang('invalid-value'), ->referrerpolicy('invalid-value'), ->role('invalid-value'), and ->translate('invalid-value'), or collapse them into a single minimal integration smoke test that asserts Link delegates attribute validation to the trait (e.g., call one method with an invalid value and assert an InvalidArgumentException) and rely on the existing trait tests (e.g., HasTypeTest/TypeProvider style tests) for exhaustive validation coverage.
🤖 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/Flow/MainTest.php`:
- Around line 766-862: Remove or trim duplicate trait-level validation tests
from MainTest.php: delete the methods
testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex, and
testThrowInvalidArgumentExceptionWhenSettingTranslate (they exercise
html-attribute trait validation). Keep at most one small integration smoke test
that verifies Main::tag() forwards attributes to the traits if you want an
integration check; otherwise delete these methods and rely on the html-attribute
package tests (e.g., HasTypeTest) for validation coverage. Ensure any remaining
test references Main::tag(), GlobalAttribute, and the specific Enum classes
(ContentEditable, Direction, Draggable, Language, Role, Translate) are
consistent with the reduced test.
In `@tests/Form/InputDateTest.php`:
- Around line 1027-1108: These tests in InputDateTest duplicate trait-level
validation already covered by the html-attribute package; remove or trim the
repeated InvalidArgumentException tests (those calling InputDate::tag()->dir(),
->lang(), ->role(), ->tabIndex(), ->translate(), ->type()) and instead keep a
single small integration test that verifies InputDate renders/accepts a valid
attribute value; rely on HasType/HasForm/other trait test suites for exhaustive
validation of trait behavior.
In `@tests/Form/InputImageTest.php`:
- Around line 1036-1048: Replace the fully-qualified reference
\UIAwesome\Html\Attribute\Exception\Message with a named import alias at the top
of the test file (e.g., use UIAwesome\Html\Attribute\Exception\Message as
AttributeMessage;) and update the assertion to call
AttributeMessage::ATTRIBUTE_INVALID_VALUE->getMessage(...) instead of the FQN;
this keeps the existing UIAwesome\Html\Helper\Exception\Message import intact
(Message) and makes both message classes visible symmetrically, leaving the rest
of the test (InputImage::tag()->tabIndex(-2) and GlobalAttribute::TABINDEX)
unchanged.
In `@tests/Form/InputMonthTest.php`:
- Around line 1066-1078: The test uses the fully-qualified class name
\UIAwesome\Html\Attribute\Exception\Message inline to avoid collision with the
already-imported UIAwesome\Html\Helper\Exception\Message alias; instead add an
aliased use statement (for example: use
UIAwesome\Html\Attribute\Exception\Message as AttributeMessage) at the top of
the test file and update the assertion in
testThrowInvalidArgumentExceptionWhenSettingTabindex to reference
AttributeMessage::ATTRIBUTE_INVALID_VALUE->getMessage(...) rather than the
inline FQCN so the code is more readable while preserving the disambiguation.
In `@tests/Form/InputNumberTest.php`:
- Around line 1078-1090: Replace the FQCN usage of
\UIAwesome\Html\Attribute\Exception\Message in
testThrowInvalidArgumentExceptionWhenSettingTabindex with an aliased import to
avoid the naming collision with UIAwesome\Html\Helper\Exception\Message; add a
use statement such as "use UIAwesome\Html\Attribute\Exception\Message as
AttrMessage" at the top of the file, then update the expectation to call
AttrMessage::ATTRIBUTE_INVALID_VALUE->getMessage(...) (keeping the same
parameters) while leaving InputNumber::tag()->tabIndex(-2) and
GlobalAttribute::TABINDEX unchanged.
In `@tests/Form/InputPasswordTest.php`:
- Around line 1039-1163: Remove the duplicated trait-level validation tests from
InputPasswordTest that assert InvalidArgumentException for shared attribute
traits (the test methods calling InputPassword::tag()->dir(...), inputMode(...),
lang(...), maxlength(...), minlength(...), role(...), tabIndex(...),
translate(...), and type(...)); rely on the html-attribute package's
HasType/HasForm/etc. tests for validation behavior instead, and if needed
replace them with a single minimal integration/rendering test that ensures
InputPassword renders correctly with valid attribute values (exercise
InputPassword::tag()->type(...)/maxlength(...)/dir(...), etc., with valid
inputs) rather than repeating trait validation assertions.
In `@tests/Form/InputSearchTest.php`:
- Around line 1049-1160: Remove the redundant trait-level validation tests from
InputSearchTest: delete the methods
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingMaxlength,
testThrowInvalidArgumentExceptionWhenSettingMinlength,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate, and
testThrowInvalidArgumentExceptionWhenSettingType; instead, if you want a minimal
class-level check keep a single smoke/integration assertion that
InputSearch::tag()->type('search')->render() (or similar) produces the expected
input markup, and rely on the html-attribute package tests (e.g., HasTypeTest)
for the detailed validation behavior of the HasType/HasForm/other attribute
traits.
In `@tests/Form/InputSubmitTest.php`:
- Around line 995-1077: These six tests duplicate trait-level validation already
covered by html-attribute; remove the methods
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate, and
testThrowInvalidArgumentExceptionWhenSettingType from InputSubmitTest.php (they
exercise HasDir, HasLang, HasRole, HasTabIndex, HasTranslate, HasType
respectively) and instead add/keep only class-specific integration/rendering
tests for InputSubmit (e.g., verify rendering output or attributes propagation)
if needed to cover InputSubmit-specific behavior.
- Around line 1037-1049: The test uses the fully-qualified class name
\UIAwesome\Html\Attribute\Exception\Message in the expectation because Message
is already imported for a different namespace; add a use-alias at the top of the
file (e.g., use UIAwesome\Html\Attribute\Exception\Message as AttributeMessage;)
and then replace the FQCN in the assertion with the alias (so the
expectExceptionMessage call uses
AttributeMessage::ATTRIBUTE_INVALID_VALUE->getMessage(...)), keeping the rest of
the test (InputSubmit::tag()->tabIndex(-2)) unchanged.
In `@tests/Form/InputTelTest.php`:
- Around line 1038-1148: These tests duplicate trait-level validation (HasType,
HasForm, etc.)—remove the invalid-argument tests in InputTelTest that only
exercise trait validation (the methods calling InputTel::tag()->dir(...),
lang(...), maxlength(...), minlength(...), role(...), tabIndex(...),
translate(...), type(...)) and instead keep only InputTel-specific
integration/rendering tests; if you want a lightweight check, replace each
removed test with a single assertion that the attribute setter exists on
InputTel (e.g., a smoke/assertion that InputTel::tag()->type('tel')
renders/returns a tag) and rely on the html-attribute package tests for the
validation behavior.
In `@tests/Form/InputTextTest.php`:
- Around line 1082-1136: Add a single import alias for
UIAwesome\Html\Attribute\Exception\Message at the top of the file and replace
the three fully-qualified occurrences in the test methods
(testThrowInvalidArgumentExceptionWhenSettingMaxlength,
testThrowInvalidArgumentExceptionWhenSettingMinlength,
testThrowInvalidArgumentExceptionWhenSettingTabindex) with the aliased short
name; this keeps style consistent with the rest of the file and removes the
inline FQCNs used when building the expected exception messages.
In `@tests/Form/InputWeekTest.php`:
- Around line 1027-1095: Remove the five trait-specific tests that duplicate
validation already covered by the html-attribute package: delete the methods
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex, and
testThrowInvalidArgumentExceptionWhenSettingTranslate from the InputWeekTest;
keep only tests that exercise InputWeek-specific behavior (e.g.,
testThrowInvalidArgumentExceptionWhenSettingType) because
HasDir/HasLang/HasRole/HasTabindex/HasTranslate validation lives in traits and
is tested in the html-attribute package.
- Around line 1069-1081: Add a use import alias for the Message enum to avoid
the long FQCN in the test: add a top-level import like "use
UIAwesome\Html\Attribute\Exception\Message as Message;" (or a short alias) and
then replace the fully-qualified Message reference in the expectExceptionMessage
call with the aliased Message::ATTRIBUTE_INVALID_VALUE->getMessage(...) so the
test uses the same import style as the rest of the file; keep the rest of the
assertion and the call to InputWeek::tag()->tabIndex(-2) unchanged.
In `@tests/Form/TextAreaTest.php`:
- Line 13: Add an aliased import for UIAwesome\Html\Attribute\Exception\Message
(for example: use UIAwesome\Html\Attribute\Exception\Message as
AttributeMessage;) to avoid repeated fully-qualified class names; then replace
the five FQCN usages of UIAwesome\Html\Attribute\Exception\Message in this test
file with the new alias (keeping the existing import of
UIAwesome\Html\Helper\Exception\Message as-is) so the code references
AttributeMessage where those five call sites currently use the long FQCN.
In `@tests/Heading/HGroupTest.php`:
- Around line 819-831: Alias the fully-qualified exception message class to keep
imports consistent: add a named import like "use
UIAwesome\Html\Attribute\Exception\Message as AttributeMessage;" and replace the
inline FQN in testThrowInvalidArgumentExceptionWhenSettingTabindex with
AttributeMessage::ATTRIBUTE_INVALID_VALUE->getMessage(...). This keeps the
existing UIAwesome\Html\Helper\Exception\Message import, removes the inline FQN,
and leaves the rest of the test (including HGroup::tag()->tabIndex(-2))
unchanged.
In `@tests/List/DdTest.php`:
- Around line 751-847: These tests in DdTest (methods
testThrowInvalidArgumentExceptionWhenSettingContentEditable/Dir/Draggable/Lang/Role/Tabindex/Translate)
duplicate validation that belongs to the shared html-attribute package; remove
or skip the trait-level InvalidArgumentException assertions (calls like
Dd::tag()->contentEditable('invalid-value') etc.) and instead keep only
Dd-specific integration/rendering tests that exercise attribute rendering and
class integration; if you need coverage here, convert one representative case
per attribute to a rendering/assertion test (not validation) or add a note
referencing the existing html-attribute tests (e.g.,
HasTypeTest.php/TypeProvider.php) so trait validation remains tested in its own
package.
In `@tests/List/OlTest.php`:
- Around line 876-888: Remove the duplicated trait-level validation tests from
OlTest: delete the seven testThrowInvalidArgumentException* methods that call
Ol::tag()->contentEditable(...), ->dir(...), ->draggable(...), ->lang(...),
->role(...), ->tabIndex(...), and ->translate(...); these validations are
already covered in the html-attribute package (HasContentEditable, HasDir,
HasDraggable, HasLang, HasRole, HasTabIndex, HasTranslate) so keep only
Ol-specific integration/rendering tests and do not re-test trait
validation/null-handling here.
- Around line 946-958: The test uses the fully-qualified class name
\UIAwesome\Html\Attribute\Exception\Message inline; add a use alias at the top
(for example: use UIAwesome\Html\Attribute\Exception\Message as AttrMessage) and
update the expectation in testThrowInvalidArgumentExceptionWhenSettingTabindex
to call AttrMessage::ATTRIBUTE_INVALID_VALUE->getMessage(...) instead of the
FQCN, leaving GlobalAttribute and Ol::tag()->tabIndex(-2) as-is.
In `@tests/Palpable/ATest.php`:
- Around line 830-926: These tests duplicate trait-level validation already
covered in the html-attribute package; remove the per-attribute invalid-value
tests in ATest.php (methods testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingReferrerpolicy,
testThrowInvalidArgumentExceptionWhenSettingRel,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTranslate,
testThrowInvalidArgumentExceptionWhenSettingType) and either delete them or
replace them with a single element-specific integration smoke test (e.g.,
testInvalidAttributeValueThrowsForAnchor) that asserts an
InvalidArgumentException is raised for one representative attribute (reference
A::tag()->type or A::tag()->rel) so the class integration is exercised without
re-testing trait validation (traits: HasType, HasForm, etc.).
In `@tests/Sectioning/AsideTest.php`:
- Around line 821-833: Replace the fully-qualified class name
\UIAwesome\Html\Attribute\Exception\Message::ATTRIBUTE_INVALID_VALUE with the
imported alias to improve readability: add an import alias (e.g., use
UIAwesome\Html\Attribute\Exception\Message as AttributeMessage;) alongside
existing imports, then update the assertion to call
AttributeMessage::ATTRIBUTE_INVALID_VALUE->getMessage(...) instead of the FQCN;
keep the rest of the test (Aside::tag()->tabIndex(-2) and
GlobalAttribute::TABINDEX->value) unchanged.
---
Outside diff comments:
In `@src/Form/Attribute/HasFormaction.php`:
- Line 14: The `@link` in the HasFormaction.php docblock points to a 404; update
the URL to MDN's valid anchor for the formaction attribute (for example use
"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-formaction"
or the equivalent button element anchor). Edit the docblock in
src/Form/Attribute/HasFormaction.php to replace the invalid link with the
correct MDN element anchor (keep the rest of the docblock unchanged and ensure
the link targets the formaction attribute anchor).
In `@tests/Metadata/LinkTest.php`:
- Around line 877-959: These tests duplicate trait-level validation covered by
the html-attribute package; remove the individual invalid-argument tests in
LinkTest that call Link::tag()->dir('invalid-value'),
->fetchpriority('invalid-value'), ->lang('invalid-value'),
->referrerpolicy('invalid-value'), ->role('invalid-value'), and
->translate('invalid-value'), or collapse them into a single minimal integration
smoke test that asserts Link delegates attribute validation to the trait (e.g.,
call one method with an invalid value and assert an InvalidArgumentException)
and rely on the existing trait tests (e.g., HasTypeTest/TypeProvider style
tests) for exhaustive validation coverage.
In `@tests/Metadata/MetaTest.php`:
- Around line 645-713: Remove the duplicated trait-level validation tests from
MetaTest: delete the methods testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingHttpEquiv,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole, and
testThrowInvalidArgumentExceptionWhenSettingTranslate (these exercise
global-attribute trait validation already covered in the html-attribute
package); alternatively replace them with a single lightweight integration/smoke
test that ensures Meta::tag() accepts valid values and renders without
delegating to trait-level validation (e.g., call
Meta::tag()->dir('ltr')->render() and assert output contains the attribute) so
Meta-specific behavior is covered but trait validation remains tested in the
trait package.
---
Duplicate comments:
In `@tests/Embedded/ImgTest.php`:
- Around line 942-1037: These tests are redundant because they assert
trait-level validation already covered in the html-attribute package; remove the
duplicate invalid-value tests from ImgTest (e.g.,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingFetchpriority,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingLoading,
testThrowInvalidArgumentExceptionWhenSettingReferrerpolicy,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTranslate) that call
Img::tag()->dir('invalid-value') and similar, and instead keep only Img-specific
integration/rendering tests; if you need to preserve coverage, replace them with
a single small test asserting that Img integrates the trait (e.g., rendering of
a known valid attribute) rather than re-testing trait validation logic.
In `@tests/Flow/DivTest.php`:
- Around line 766-862: The tests in DivTest (the cases invoking
Div::tag()->contentEditable(...), ->dir(...), ->draggable(...), ->lang(...),
->role(...), ->tabIndex(...), ->translate(...)) duplicate trait-level validation
already covered by html-attribute tests; remove these duplicate invalid-argument
tests or replace them with a narrow integration test that verifies Div correctly
delegates to the trait (e.g., assert that setting a valid value renders expected
attribute) rather than re-testing trait validation logic. Locate the methods
contentEditable, dir, draggable, lang, role, tabIndex, and translate on
Div::tag() and either delete the invalid-value expectation blocks or convert one
representative case into an element-specific behavior/integration assertion.
In `@tests/Flow/PTest.php`:
- Around line 766-861: These tests (e.g.,
testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate) duplicate trait-level
validation already covered by the html-attribute package; remove or skip these
P-specific tests that only exercise global attribute validation (calls like
P::tag()->contentEditable('invalid-value') etc.) and replace them with focused
tests that assert P-specific integration/rendering behavior instead (keep
class-specific scenarios only).
In `@tests/Form/ButtonTest.php`:
- Around line 841-937: Remove the redundant trait-level validation tests from
ButtonTest.php that duplicate html-attribute package coverage: delete or skip
the tests testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingPopoverTargetAction,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate, and
testThrowInvalidArgumentExceptionWhenSettingType; keep only Button-specific
integration/rendering tests and rely on the html-attribute package tests (e.g.,
HasTypeTest.php/TypeProvider.php) for shared trait validation of methods invoked
via Button::tag()->dir(), ->lang(), ->popoverTargetAction(), ->role(),
->tabIndex(), ->translate(), and ->type().
In `@tests/Form/InputCheckboxTest.php`:
- Around line 929-1011: These tests in InputCheckboxTest (the methods
testThrowInvalidArgumentExceptionWhenSettingDir, ...Lang, ...Role, ...Tabindex,
...Translate, ...Type) duplicate trait-level validation already covered by the
html-attribute package; remove these trait-specific invalid-value tests and keep
only InputCheckbox-specific integration/rendering tests (i.e., tests that assert
how InputCheckbox::tag() uses attributes in output), or alternatively mark them
as redundant/skipped—do not add validation coverage for traits like
HasType/HasForm/HasGlobalAttributes here.
In `@tests/Form/InputColorTest.php`:
- Around line 1001-1083: Remove the redundant trait-level validation tests from
InputColorTest by deleting the methods that only assert shared attribute
validation (they duplicate html-attribute package tests):
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate, and
testThrowInvalidArgumentExceptionWhenSettingType; keep only InputColor-specific
integration/rendering tests and rely on the existing HasType/HasForm/etc. tests
in the html-attribute package for trait behavior.
In `@tests/Form/InputFileTest.php`:
- Around line 949-1031: These tests duplicate validation already covered by the
html-attribute package; remove (or skip) the redundant trait-level tests in
InputFileTest — specifically the methods
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate, and
testThrowInvalidArgumentExceptionWhenSettingType — and keep only
InputFile-specific integration/rendering tests that assert InputFile::tag()
correctly uses the trait setters (dir(), lang(), role(), tabIndex(),
translate(), type()) in output rather than re-testing enum/validation logic
already covered by HasType/HasDir/etc. in html-attribute.
In `@tests/Form/InputResetTest.php`:
- Around line 868-950: These tests duplicate trait-level validation already
covered by html-attribute tests; remove the invalid-argument unit tests
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate, and
testThrowInvalidArgumentExceptionWhenSettingType from InputResetTest and instead
add or keep only element-specific integration assertions that exercise
InputReset::tag() rendering/attribute plumbing (e.g., that valid values are
rendered or omitted correctly), while leaving trait validation (HasType,
HasForm, etc.) to the html-attribute package tests.
In `@tests/Form/InputTimeTest.php`:
- Around line 1023-1105: Remove the redundant trait-level validation tests from
InputTimeTest.php — specifically delete the methods
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate, and
testThrowInvalidArgumentExceptionWhenSettingType — because these validations are
covered by the html-attribute package tests (e.g.,
HasTypeTest.php/TypeProvider.php); instead keep or add only InputTime-specific
integration/rendering tests that assert the tag output (via InputTime::tag())
for valid attribute values and overall rendering, but do not re-test trait
validation logic.
In `@tests/Heading/H2Test.php`:
- Around line 751-846: Remove the duplicate trait-level validation tests from
H2Test — specifically the methods
testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex, and
testThrowInvalidArgumentExceptionWhenSettingTranslate — because they exercise
shared global-attribute validation implemented in traits (e.g., the validation
logic covered by html-attribute tests); instead either delete these methods or
replace them with a single minimal integration test that asserts H2::tag()
forwards attributes (e.g., contentEditable/dir/etc.) to the renderer, leaving
detailed invalid-value tests to the html-attribute package tests.
In `@tests/List/DlTest.php`:
- Around line 830-925: These Dl tests duplicate trait-level validation already
covered elsewhere; remove or replace the methods that only assert
global-attribute validation (the tests invoking Dl::tag()->contentEditable(),
->dir(), ->draggable(), ->lang(), ->role(), ->tabIndex(), ->translate()) and
instead keep or add tests that verify Dl-specific integration/rendering
behavior; if you still need coverage for attribute propagation, call out a
single integration test asserting attributes render correctly on a Dl instance
rather than repeating the enum/validation failures tested in the html-attribute
package (see the analogous DdTest.php duplication note).
In `@tests/List/DtTest.php`:
- Around line 751-847: These tests duplicate trait-level validation already
covered by html-attribute tests; remove the per-attribute invalid-value tests
that call Dt::tag()->contentEditable(...), dir(...), draggable(...), lang(...),
role(...), tabIndex(...), and translate(...) and either delete them or replace
them with a single Dt integration test that asserts element-specific
integration/rendering (e.g., that Dt::tag() accepts valid values and renders
attributes correctly) while leaving trait validation to the html-attribute test
suite.
In `@tests/List/LiTest.php`:
- Around line 781-877: The tests in LiTest.php duplicate trait-level validation
already covered in the html-attribute package; remove or narrow the duplicate
cases (the tests invoking Li::tag()->contentEditable(), ->dir(), ->draggable(),
->lang(), ->role(), ->tabIndex(), ->translate()) and instead add only
element-specific integration tests (e.g., that Li renders these attributes when
given valid values or that Li integrates with trait validation using a single
representative invalid case), leaving detailed trait validation to the
html-attribute test suite.
In `@tests/List/UlTest.php`:
- Around line 808-903: These tests duplicate trait-level validation (global
attribute checks) and should be removed or replaced with Ul-specific assertions:
delete or skip the test methods
testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex, and
testThrowInvalidArgumentExceptionWhenSettingTranslate that call
Ul::tag()->contentEditable(...), ->dir(...), ->draggable(...), ->lang(...),
->role(...), ->tabIndex(...), and ->translate(...); if you need coverage here,
replace them with tests that assert Ul-specific integration or rendering
behavior (e.g., that valid values render correctly) rather than re-testing trait
validation which lives in the html-attribute package.
In `@tests/Metadata/StyleTest.php`:
- Around line 892-987: Remove the duplicated trait-level validation tests from
StyleTest.php (methods like
testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate) because they exercise
shared global-attribute/trait validation already covered by the html-attribute
package (e.g., HasType/HasForm and their tests); instead keep only
Style-specific integration/rendering tests that assert how Style::tag()
integrates attributes or renders output, and if necessary replace removed
assertions with a single minimal test that ensures Style::tag() delegates
attribute handling without re-testing trait validation logic.
In `@tests/Metadata/TitleTest.php`:
- Around line 763-858: These tests duplicate trait-level validation already
covered in the html-attribute package; remove the duplicated methods
(testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate) that call
Title::tag()->contentEditable(...), ->dir(...), ->draggable(...), ->lang(...),
->role(...), ->tabIndex(...), ->translate(...), and instead add or keep only
Title-specific integration/rendering tests that assert Title renders attributes
correctly when given valid values.
In `@tests/Phrasing/LabelTest.php`:
- Around line 597-651: Remove the redundant trait-level validation tests in
tests/Phrasing/LabelTest.php that assert InvalidArgumentException for
Label::tag()->dir(), ->lang(), ->role(), and ->translate() because these
validations belong to shared attribute traits tested in the html-attribute
package; instead keep only Label-specific integration/rendering tests (e.g.,
attribute propagation and output), deleting the four test methods
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole, and
testThrowInvalidArgumentExceptionWhenSettingTranslate so the suite doesn't
duplicate trait coverage.
In `@tests/Root/BodyTest.php`:
- Around line 751-847: Remove the duplicate trait-level validation tests from
BodyTest.php — specifically the methods
testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex, and
testThrowInvalidArgumentExceptionWhenSettingTranslate — because trait validation
is already covered by html-attribute tests; if you need element-level coverage
instead, replace each with a minimal integration assertion that
Body::tag()-><method>(<valid-value>) actually renders the attribute (e.g.,
Body::tag()->contentEditable('true') produces contenteditable="true") rather
than re-testing InvalidArgumentException behavior.
In `@tests/Root/FooterTest.php`:
- Around line 751-847: These tests duplicate trait-level validation already
covered by html-attribute tests; remove the invalid-argument unit tests in
FooterTest that call Footer::tag()->contentEditable(...), dir(...),
draggable(...), lang(...), role(...), tabIndex(...), and translate(...) or
replace them with a single integration-style assertion that the Footer element
accepts and renders the attribute when given a valid value (e.g., verify
Footer::tag()->role('banner')->render() contains role="banner"); leave trait
validation to the html-attribute package tests and keep only element-specific
integration/rendering assertions in FooterTest.
In `@tests/Root/HeaderTest.php`:
- Around line 751-847: These tests in HeaderTest.php duplicate validation
already covered by the html-attribute package (trait-level tests); remove or
narrow the tests that call Header::tag()->contentEditable(), ->dir(),
->draggable(), ->lang(), ->role(), ->tabIndex(), and ->translate() which only
exercise trait validation, and instead add a single element-specific integration
test that asserts the Header element correctly accepts and renders a valid
attribute value (or ensures the attribute is passed through) for one
representative attribute (e.g., lang or role); leave exhaustive invalid-value
checks to the existing trait tests (e.g., HasTypeTest.php/TypeProvider).
In `@tests/Sectioning/ArticleTest.php`:
- Around line 749-845: These tests in ArticleTest duplicate trait-level
validation already covered by the html-attribute package; remove or trim the
redundant methods (testThrowInvalidArgumentExceptionWhenSettingContentEditable,
testThrowInvalidArgumentExceptionWhenSettingDir,
testThrowInvalidArgumentExceptionWhenSettingDraggable,
testThrowInvalidArgumentExceptionWhenSettingLang,
testThrowInvalidArgumentExceptionWhenSettingRole,
testThrowInvalidArgumentExceptionWhenSettingTabindex,
testThrowInvalidArgumentExceptionWhenSettingTranslate) that only assert trait
validation via Article::tag()->contentEditable(...), ->dir(...),
->draggable(...), ->lang(...), ->role(...), ->tabIndex(...), ->translate(...);
instead keep only Article-specific integration/rendering assertions (e.g., that
Article renders attributes correctly when given valid values) and remove the
duplicate invalid-value/exception assertions so trait behavior remains tested in
the html-attribute package.
Pull Request