-
Notifications
You must be signed in to change notification settings - Fork 260
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
Backport subdomain validation #477
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2.1 | ||
1.2.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace Zendesk\API\LiveTests; | ||
namespace Zendesk\API\UnitTests; | ||
|
||
use Zendesk\API\Client; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Zendesk\API\UnitTests; | ||
|
||
use Zendesk\API\Client; | ||
use InvalidArgumentException; | ||
|
||
/** | ||
* InvalidSubdomain test class | ||
*/ | ||
class InvalidSubdomainTest extends BasicTest | ||
{ | ||
public function testInvalidSubdomainThrows() | ||
{ | ||
$this->setExpectedException('InvalidArgumentException'); | ||
|
||
new Client('...', ''); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid we would need a more specific test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy to add one. What test would you like to see? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're introducing a regex, could you please provide a test that passes the validation and one that throws There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
|
||
public function testValidSubdomain() | ||
{ | ||
new Client('zendesk.example.com', 'example'); | ||
$this->assertTrue(true); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file does not exist in current master, and a similar issue has already been fixed, can you please try to merge master in here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is for the v1 branch. It doesn't make sense to merge the current master. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for the clarification. |
||
|
||
namespace Zendesk\API\LiveTests; | ||
namespace Zendesk\API\UnitTests; | ||
|
||
use Zendesk\API\Client; | ||
|
||
|
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.
Thank you ❤️