-
Notifications
You must be signed in to change notification settings - Fork 248
Fixing import issue - tenant IDs can be strings #456
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
Fixing import issue - tenant IDs can be strings #456
Conversation
@@ -196,7 +196,7 @@ public function setTenant($tenant) | |||
{ | |||
$identity = IdentityService::factory($this); | |||
|
|||
if (is_numeric($tenant)) { | |||
if (is_numeric($tenant) || is_string($tenant)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the docblock for the method to match this change, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure - will do this and tests sometime tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I should've been clearer. I meant the comment that goes "If an integer is passed in..."
Could you please add unit tests for |
@ycombinator Looks like we already test string and numeric tenant IDs but the existing tests aren't really testing what we want it to test. If the argument does not match the conditional (which it was doing before), the value populates the Tenant object. If Base.php is given a scalar value, it treats it as a ID and does a GET on that resource to get more information - which is what was happening here. Ideally, what we want to test is that strings and IDs do not execute this GET request. The only way we can efficiently do this is by mocking the exact form of communication the |
@ycombinator and this! |
Fixing import issue - tenant IDs can be strings
Fixes #455