Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] ArraySubsetAssertion #14

Merged
merged 1 commit into from
Jul 11, 2022
Merged

Conversation

nikophil
Copy link
Member

No description provided.

src/Assert/Assertion/ArraySubsetAssertion.php Outdated Show resolved Hide resolved
src/Assert/Assertion/ArraySubsetAssertion.php Outdated Show resolved Hide resolved
src/Assert/Assertion/ArraySubsetAssertion.php Outdated Show resolved Hide resolved
src/Assert/Assertion/ArraySubsetAssertion.php Outdated Show resolved Hide resolved
src/Assert/Assertion/ArraySubsetAssertion.php Outdated Show resolved Hide resolved
tests/Assertion/ArraySubsetAssertionTest.php Outdated Show resolved Hide resolved
tests/Assertion/ArraySubsetAssertionTest.php Outdated Show resolved Hide resolved
@nikophil nikophil force-pushed the assert-array-subset branch 4 times, most recently from c4066c7 to cfedeb5 Compare July 1, 2022 14:47
README.md Show resolved Hide resolved
src/Assert/Assertion/ArraySubsetAssertion.php Show resolved Hide resolved
src/Assert/Expectation.php Outdated Show resolved Hide resolved
@nikophil nikophil marked this pull request as ready for review July 1, 2022 14:55
@nikophil nikophil marked this pull request as draft July 1, 2022 14:55
@nikophil nikophil marked this pull request as ready for review July 1, 2022 15:01
@nikophil nikophil requested a review from kbond July 1, 2022 15:01
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like this implementation!

README.md Show resolved Hide resolved
src/Assert/Assertion/ArraySubsetAssertion.php Show resolved Hide resolved
src/Assert/Assertion/ArraySubsetAssertion.php Outdated Show resolved Hide resolved
src/Assert/Expectation.php Outdated Show resolved Hide resolved
src/Assert/Expectation.php Outdated Show resolved Hide resolved
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the not assertions to Expectation: Expectation::notHasSubset() & IsNotSubsetOf().

For allowing json strings, what about leaving ArraySubsetAssertion as-is and having the Expectation method's allow json strings and decode?

@nikophil nikophil force-pushed the assert-array-subset branch 2 times, most recently from 1e9a8ed to 20e09ec Compare July 11, 2022 09:06
@nikophil
Copy link
Member Author

nikophil commented Jul 11, 2022

We should add the not assertions to Expectation: Expectation::notHasSubset() & IsNotSubsetOf().

done

For allowing json strings, what about leaving ArraySubsetAssertion as-is and having the Expectation method's allow json strings and decode?

I'd rather do it inside ArraySubsetAssertion because we already have a private method toArray that we apply on both needle and haystack. this would prevent to add a method specific to array subsets inside Expectation class

@nikophil nikophil force-pushed the assert-array-subset branch 4 times, most recently from 89fcd74 to b1af4f6 Compare July 11, 2022 09:58
@nikophil nikophil requested a review from kbond July 11, 2022 09:59
Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Just one small type check change.

Do you want to merge nikophil#1 into this PR or do it in a separate follow-up?

src/Assert/Assertion/ArraySubsetAssertion.php Outdated Show resolved Hide resolved
@kbond kbond merged commit ca27cac into zenstruck:1.x Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants