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

Add toBeTruthy and ToBeFalsy #367

Merged
merged 2 commits into from
Aug 4, 2021
Merged

Add toBeTruthy and ToBeFalsy #367

merged 2 commits into from
Aug 4, 2021

Conversation

gabbanaesteban
Copy link
Contributor

Q A
Bug fix? no
New feature? yes

This PR adds toBeTruthy and toBeFalsy.

Useful when you don't care what a value is and you want to ensure a value is true or false in a boolean context.

expect("true")->toBeTruthy(); // passes
expect("0")->toBeTruthy(); // doest not pass

expect("0")->toBeFalsy(); // passes
expect("false")->toBeFalsy(); // doest not pass

@gabbanaesteban gabbanaesteban changed the title Add toBeTruthy and ToBeFalsy Add toBeTruthy and ToBeFalsy Aug 4, 2021
expect([])->not->toBeTruthy();
expect(0)->not->toBeTruthy();
expect('0')->not->toBeTruthy();
});
Copy link
Member

Choose a reason for hiding this comment

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

Can you use a dataset here?

expect('false')->not->toBeFalsy();
expect(1)->not->toBeFalsy();
expect(-1)->not->toBeFalsy();
});
Copy link
Member

Choose a reason for hiding this comment

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

Can you use a dataset here?

Copy link
Member

@owenvoke owenvoke left a comment

Choose a reason for hiding this comment

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

Nice new addition! LGTM after @nunomaduro's comments have been addressed.

@nunomaduro nunomaduro merged commit 30f39f1 into pestphp:master Aug 4, 2021
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