Skip to content

[12.x] Add test for untested methods in LazyCollection #54996

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

Merged

Conversation

mohammadrasoulasghari
Copy link
Contributor

@mohammadrasoulasghari mohammadrasoulasghari commented Mar 12, 2025

Add test coverage for untested methods in LazyCollection

I added test coverage for untested before() and shuffle() methods in LazyCollection class

These methods previously had no test coverage. I implemented comprehensive test cases for both methods:

For before() method:

  • Non-strict comparison with simple numeric values ✅
  • Strict comparison with mixed types
  • Callback function testing with complex data structures

For shuffle() method:

  • Numeric array shuffling validation (maintaining all elements) 🎲
  • Associative array shuffling (preserving key-value relationships)

Each test case covers different edge cases and scenarios to ensure proper functionality and prevent potential side effects during future modifications. The tests validate both simple and complex use cases, ensuring the methods work as expected across different data types and structures. 🛡️

This commit adds test coverage for the before() method including:
- Non-strict comparison
- Strict comparison
- Callback function usage
@mohammadrasoulasghari mohammadrasoulasghari changed the title [12.x]add test cases for before() method [12.x] Add test for untested methods in LazyCollection Mar 12, 2025
This commit adds test coverage for the shuffle() method including:
@mohammadrasoulasghari mohammadrasoulasghari force-pushed the tests/lazy-collection-tests branch from bd28a1e to efe7171 Compare March 12, 2025 19:32
@taylorotwell taylorotwell merged commit 79fdf0c into laravel:12.x Mar 13, 2025
39 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