Merge pull request #12271 from jrfnl/feature/vcs-github-expand-funding-tests
GitHubDriverTest::testFundingFormat(): expand the tests + fix bugpull/12284/head
commit
c0dece23e5
|
@ -288,7 +288,7 @@ class GitHubDriver extends VcsDriver
|
||||||
$result[$key]['url'] = 'https://www.buymeacoffee.com/' . basename($item['url']);
|
$result[$key]['url'] = 'https://www.buymeacoffee.com/' . basename($item['url']);
|
||||||
break;
|
break;
|
||||||
case 'thanks_dev':
|
case 'thanks_dev':
|
||||||
$result[$key]['url'] = 'https://thanks.dev/' . basename($item['url']);
|
$result[$key]['url'] = 'https://thanks.dev/' . $item['url'];
|
||||||
break;
|
break;
|
||||||
case 'otechie':
|
case 'otechie':
|
||||||
$result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
|
$result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
|
||||||
|
|
|
@ -285,8 +285,80 @@ class GitHubDriverTest extends TestCase
|
||||||
|
|
||||||
public static function fundingUrlProvider(): array
|
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 [
|
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',
|
'custom: example.com',
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
@ -295,7 +367,7 @@ class GitHubDriverTest extends TestCase
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
'Custom: single schemaless URL in array format' => [
|
||||||
'custom: [example.com]',
|
'custom: [example.com]',
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
@ -304,7 +376,7 @@ class GitHubDriverTest extends TestCase
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
'Custom: double-quoted single URL' => [
|
||||||
'custom: "https://example.com"',
|
'custom: "https://example.com"',
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
@ -313,7 +385,7 @@ class GitHubDriverTest extends TestCase
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
'Custom: double-quoted single URL in array format' => [
|
||||||
'custom: ["https://example.com"]',
|
'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]',
|
'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]',
|
'custom: [example.net/funding, "https://example.com", example.org]',
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue