Skip to content

Commit fbe583e

Browse files
committed
Add tests for License class's logic
1 parent 4ffd40f commit fbe583e

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PH7\PhpReadmeGeneratorFile\Tests\Command\Markdown;
6+
7+
use PH7\PhpReadmeGeneratorFile\Command\Markdown\License;
8+
use PHPUnit\Framework\TestCase;
9+
10+
class LicenseTest extends TestCase
11+
{
12+
/**
13+
* @dataProvider licenseCodeProvider
14+
*/
15+
public function testLinkWithValidLicenseCode(string $licenseCode): void
16+
{
17+
$actual = License::getLicenseLink($licenseCode);
18+
$this->assertsame("https://opensource.org/licenses/{$licenseCode}", $actual);
19+
}
20+
21+
public function testLinkWithInvalidLicenseCode(): void
22+
{
23+
$actual = License::getLicenseLink('INVALID');
24+
$this->assertsame('https://opensource.org/licenses', $actual);
25+
}
26+
27+
public function licenseCodeProvider(): array
28+
{
29+
return [License::CODES];
30+
}
31+
32+
}

0 commit comments

Comments
 (0)