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

[11.x] Add tests to improve test coverage for Arr::whereNotNull #51661

Merged
merged 2 commits into from
May 31, 2024

Conversation

saMahmoudzadeh
Copy link
Contributor

This PR, adds tests to improve the test coverage of Arr::whereNotNull.

The array contains only numeric items

$array = array_values(Arr::whereNotNull([1, 2, 3]));
$this->assertEquals([1, 2, 3], $array);

The array contains only null values

$array = array_values(Arr::whereNotNull([null, null, null]));
$this->assertEquals([], $array);

An array consisting of a mix of characters and null values.

$array = array_values(Arr::whereNotNull(['a', null, 'b', null, 'c']));
$this->assertEquals(['a', 'b', 'c'], $array);

An array containing various data types.

$array = array_values(Arr::whereNotNull([null, 1, 'string', 0.0, false, [], new stdClass(), function () {}]));
$this->assertEquals([1, 'string', 0.0, false, [], new stdClass(), function () {}], $array);

@taylorotwell taylorotwell merged commit f05f7bc into laravel:11.x May 31, 2024
28 checks passed
@saMahmoudzadeh saMahmoudzadeh deleted the tests/add-tests-arr branch May 31, 2024 16:41
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