Skip to content

Commit

Permalink
Merge pull request #67 from WyriHaximus-labs/support-emojis-in-labels
Browse files Browse the repository at this point in the history
Support Emoji in labels
  • Loading branch information
WyriHaximus authored Apr 11, 2021
2 parents 0185ce9 + 3b2aa0e commit cd4d35e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ChangelogGenerator/ChangelogConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function getMilestoneIssuesUrl(string $label): string
$this->user,
$this->repository,
$this->includeOpen ? '' : ' state:closed',
$label !== '' ? ' label:' . $label : ''
$label !== '' ? ' label:"' . $label . '"' : ''
));

return sprintf('%s/search/issues?q=%s', $this->getRootGitHubUrl(), $query);
Expand Down
15 changes: 11 additions & 4 deletions tests/ChangelogGenerator/Tests/ChangelogConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testGetSetOption(): void

public function testGetMilestoneIssuesUrl(): void
{
self::assertSame('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed+label%3AEnhancement', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
self::assertSame('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed+label%3A%22Enhancement%22', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
}

public function testGetMilestoneIssuesUrlNoLabel(): void
Expand All @@ -103,21 +103,28 @@ public function testGetMilestoneIssuesUrlWithCustomRootGitHubUrl(): void
{
$this->changelogConfig->setOptions(['rootGitHubUrl' => 'https://git.mycompany.com/api/v3']);

self::assertSame('https://git.mycompany.com/api/v3/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed+label%3AEnhancement', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
self::assertSame('https://git.mycompany.com/api/v3/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed+label%3A%22Enhancement%22', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
}

public function testGetMilestoneIssuesUrlWithMissingRootGitHubUrl(): void
{
$this->changelogConfig->setOptions([]);

self::assertSame('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed+label%3AEnhancement', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
self::assertSame('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed+label%3A%22Enhancement%22', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
}

public function testGetMilestoneIssuesUrlWithOpenIncluded(): void
{
$this->changelogConfig->setIncludeOpen(true);

self::assertSame('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+label%3AEnhancement', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
self::assertSame('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+label%3A%22Enhancement%22', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
}

public function testGetMilestoneIssuesUrlWithEmojiInLabel(): void
{
$this->changelogConfig->setIncludeOpen(true);

self::assertSame('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+label%3A%22Bug+%F0%9F%90%9E%22', $this->changelogConfig->getMilestoneIssuesUrl('Bug 🐞'));
}

public function testIsValid(): void
Expand Down

0 comments on commit cd4d35e

Please sign in to comment.