1
0
Fork 0

Merge pull request #12271 from jrfnl/feature/vcs-github-expand-funding-tests

GitHubDriverTest::testFundingFormat(): expand the tests + fix bug
pull/12284/head
Jordi Boggiano 2025-01-20 09:59:30 +01:00 committed by GitHub
commit c0dece23e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 79 additions and 7 deletions

View File

@ -288,7 +288,7 @@ class GitHubDriver extends VcsDriver
$result[$key]['url'] = 'https://www.buymeacoffee.com/' . basename($item['url']);
break;
case 'thanks_dev':
$result[$key]['url'] = 'https://thanks.dev/' . basename($item['url']);
$result[$key]['url'] = 'https://thanks.dev/' . $item['url'];
break;
case 'otechie':
$result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);

View File

@ -285,8 +285,80 @@ class GitHubDriverTest extends TestCase
public static function fundingUrlProvider(): array
{
$allNamedPlatforms = <<<'FUNDING'
community_bridge: project-name
github: [userA, userB]
issuehunt: userName
ko_fi: userName
liberapay: userName
open_collective: userName
patreon: userName
tidelift: Platform/Package
polar: userName
buy_me_a_coffee: userName
thanks_dev: u/gh/userName
otechie: userName
FUNDING;
return [
'All named platforms' => [
$allNamedPlatforms,
[
[
'type' => 'community_bridge',
'url' => 'https://funding.communitybridge.org/projects/project-name',
],
[
'type' => 'github',
'url' => 'https://github.com/userA',
],
[
'type' => 'github',
'url' => 'https://github.com/userB',
],
[
'type' => 'issuehunt',
'url' => 'https://issuehunt.io/r/userName',
],
[
'type' => 'ko_fi',
'url' => 'https://ko-fi.com/userName',
],
[
'type' => 'liberapay',
'url' => 'https://liberapay.com/userName',
],
[
'type' => 'open_collective',
'url' => 'https://opencollective.com/userName',
],
[
'type' => 'patreon',
'url' => 'https://www.patreon.com/userName',
],
[
'type' => 'tidelift',
'url' => 'https://tidelift.com/funding/github/Platform/Package',
],
[
'type' => 'polar',
'url' => 'https://polar.sh/userName',
],
[
'type' => 'buy_me_a_coffee',
'url' => 'https://www.buymeacoffee.com/userName',
],
[
'type' => 'thanks_dev',
'url' => 'https://thanks.dev/u/gh/userName',
],
[
'type' => 'otechie',
'url' => 'https://otechie.com/userName',
],
],
],
'Custom: single schemaless URL' => [
'custom: example.com',
[
[
@ -295,7 +367,7 @@ class GitHubDriverTest extends TestCase
],
],
],
[
'Custom: single schemaless URL in array format' => [
'custom: [example.com]',
[
[
@ -304,7 +376,7 @@ class GitHubDriverTest extends TestCase
],
],
],
[
'Custom: double-quoted single URL' => [
'custom: "https://example.com"',
[
[
@ -313,7 +385,7 @@ class GitHubDriverTest extends TestCase
],
],
],
[
'Custom: double-quoted single URL in array format' => [
'custom: ["https://example.com"]',
[
[
@ -322,7 +394,7 @@ class GitHubDriverTest extends TestCase
],
],
],
[
'Custom: array with quoted URL and schemaless unquoted URL' => [
'custom: ["https://example.com", example.org]',
[
[
@ -335,7 +407,7 @@ class GitHubDriverTest extends TestCase
],
],
],
[
'Custom: array containing a non-simple scheme-less URL which will be discarded' => [
'custom: [example.net/funding, "https://example.com", example.org]',
[
[