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] Allow using strings when controlling UUID generation #53020

Closed
wants to merge 2 commits into from

Conversation

timacdonald
Copy link
Member

This PR allows improves the use of strings when controlling UUIDs in your testsuite. A Uuid object is now always returned.

Str::uuid(); // instanceof Uuid
Str::uuid()->toString(); // is_string

Str::createUuidsUsingSequence(['6201c046-a8d7-47e5-8ac7-cd0cbdb3b9f4']);

// Before...

Str::uuid(); // '6201c046-a8d7-47e5-8ac7-cd0cbdb3b9f4'

// Now...

Str::uuid(); // instanceof Uuid
Str::uuid()->toString(); // '6201c046-a8d7-47e5-8ac7-cd0cbdb3b9f4'

This also applies to the more generic createUuidsUsing:

Str::uuid(); // instanceof Uuid
Str::uuid()->toString(); // is_string


Str::createUuidsUsing(fn () => '6201c046-a8d7-47e5-8ac7-cd0cbdb3b9f4');

// Before...

Str::uuid(); // '6201c046-a8d7-47e5-8ac7-cd0cbdb3b9f4'

// Now...

Str::uuid(); // instanceof Uuid
Str::uuid()->toString(); // '6201c046-a8d7-47e5-8ac7-cd0cbdb3b9f4'

@Jubeki
Copy link
Contributor

Jubeki commented Oct 3, 2024

Hey @timacdonald, I think you should add a check for using a null value. Because that would be unsetting the factoring normally, but now be called as a function.

@taylorotwell
Copy link
Member

Tests failing on this one.

@taylorotwell taylorotwell marked this pull request as draft October 3, 2024 17:42
@timacdonald timacdonald closed this Oct 3, 2024
@timacdonald timacdonald deleted the uuid-factory branch October 3, 2024 23:15
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