Skip to content

Add tests and doc for the feature and that#616

Merged
fain182 merged 1 commit into
mainfrom
feature/add-tests-doc-and-that
May 23, 2026
Merged

Add tests and doc for the feature and that#616
fain182 merged 1 commit into
mainfrom
feature/add-tests-doc-and-that

Conversation

@AlessandroMinoccheri
Copy link
Copy Markdown
Member

andThat() has been part of the codebase since the AndThatShouldParser interface was introduced, but it had no dedicated tests and no documentation. This PR closes that gap.
Changes
Tests

tests/Unit/Rules/AndThatShouldTest.php — 7 unit tests covering the AND logic directly against ClassDescription objects:

class matching all conditions + should() fails → violation produced
class matching all conditions + should() passes → no violation
class matching only the first condition → should() skipped
class matching only the second condition → should() skipped
class matching neither condition → should() skipped
triple-chained andThat() — all match → violation
triple-chained andThat() — last condition not met → should() skipped
reusing a base rule with different andThat() branches produces independent rules

tests/Integration/AndThatFilterTest.php — 4 integration tests using vfsStream + TestRunner with real PHP files parsed on disk:

namespace AND naming convention filter
namespace AND attribute filter
three chained andThat() conditions
except() respected alongside andThat()

Documentation

README.md — new Combining multiple conditions with andThat() section added after the except() section, covering: basic usage, the skipping behaviour on partial matches, combining with except(), and the independent-branch pattern when reusing a partially-built rule.

Notes
No production code changes. No breaking changes.

@AlessandroMinoccheri AlessandroMinoccheri force-pushed the feature/add-tests-doc-and-that branch from 6d755da to 0c8f684 Compare May 22, 2026 19:00
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.33%. Comparing base (8968da5) to head (0c8f684).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #616   +/-   ##
=========================================
  Coverage     98.33%   98.33%           
  Complexity      693      693           
=========================================
  Files            87       87           
  Lines          1981     1981           
=========================================
  Hits           1948     1948           
  Misses           33       33           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fain182 fain182 merged commit c93d60c into main May 23, 2026
35 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