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

[2.x] Add toContainEquals expectation #974

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

erikgaal
Copy link
Contributor

@erikgaal erikgaal commented Oct 3, 2023

What:

  • Bug Fix
  • New Feature

Description:

Adds an expectation toContainEquals which is analogous to Assert::assertContainsEquals from PHPUnit.

Related:

Comment on lines 6 to 16
test('passes arrays', function () {
expect([1, 2, 42])->toContain('42');
});

test('passes arrays with multiple needles', function () {
expect([1, 2, 42])->toContain('42', '2');
});

test('failures', function () {
expect([1, 2, 42])->toContain('3');
})->throws(ExpectationFailedException::class);
Copy link
Member

Choose a reason for hiding this comment

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

I believe your goal with this was to prove that toContain does not analyze type and value, right? I don't know if we should keep these tests here because they are not part of the toContainEquals concept.

@nunomaduro , thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually these should use toContainEquals, good catch.

Copy link
Member

Choose a reason for hiding this comment

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

Actually these should use toContainEquals, good catch.

If this is wrong, please update the PR.

@nunomaduro nunomaduro merged commit 0aecd5d into pestphp:2.x Jan 25, 2024
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.

3 participants