|
2 | 2 |
|
3 | 3 | namespace Doctum\Tests; |
4 | 4 |
|
5 | | -use PHPUnit\Framework\TestCase; |
6 | 5 | use Doctum\Project; |
7 | 6 | use Doctum\Reflection\ClassReflection; |
8 | 7 | use Doctum\Store\ArrayStore; |
9 | 8 | use Doctum\Version\Version; |
10 | 9 |
|
11 | | -class ProjectTest extends TestCase |
| 10 | +class ProjectTest extends AbstractTestCase |
12 | 11 | { |
13 | 12 | public function testSwitchVersion(): void |
14 | 13 | { |
@@ -45,8 +44,80 @@ public function testSwitchVersion(): void |
45 | 44 | [ |
46 | 45 | 'C21\\C2' => $class2, |
47 | 46 | 'C31\\C32\\C3' => $class3, |
48 | | - ], |
| 47 | + ], |
49 | 48 | $project->getProjectClasses() |
50 | 49 | ); |
51 | 50 | } |
| 51 | + |
| 52 | + public function testHasFooterLink(): void |
| 53 | + { |
| 54 | + $project = $this->getProject(); |
| 55 | + |
| 56 | + $this->assertFalse($project->hasFooterLink()); |
| 57 | + |
| 58 | + $project = $this->getProject([ |
| 59 | + 'footer_link' => [ |
| 60 | + 'href' => 'https://github.com/code-lts/doctum', |
| 61 | + 'rel' => 'noreferrer noopener', |
| 62 | + 'target' => '_blank', |
| 63 | + 'before_text' => 'You can edit the configuration', |
| 64 | + 'link_text' => 'on this', // Required if the href key is set |
| 65 | + 'after_text' => 'repository', |
| 66 | + ], |
| 67 | + ]); |
| 68 | + |
| 69 | + $this->assertTrue($project->hasFooterLink()); |
| 70 | + |
| 71 | + $project = $this->getProject([ |
| 72 | + 'footer_link' => [], |
| 73 | + ]); |
| 74 | + |
| 75 | + $this->assertTrue($project->hasFooterLink()); |
| 76 | + |
| 77 | + $project = $this->getProject([ |
| 78 | + 'footer_link' => null, |
| 79 | + ]); |
| 80 | + |
| 81 | + $this->assertFalse($project->hasFooterLink()); |
| 82 | + |
| 83 | + $project = $this->getProject([ |
| 84 | + 'footer_link' => 'https://example.com', |
| 85 | + ]); |
| 86 | + |
| 87 | + $this->assertFalse($project->hasFooterLink()); |
| 88 | + } |
| 89 | + |
| 90 | + public function testGetFooterLink(): void |
| 91 | + { |
| 92 | + $project = $this->getProject(); |
| 93 | + |
| 94 | + $this->assertSame($project->getFooterLink(), [ |
| 95 | + 'href' => '', |
| 96 | + 'target' => '', |
| 97 | + 'rel' => '', |
| 98 | + 'before_text' => '', |
| 99 | + 'link_text' => '', |
| 100 | + 'after_text' => '', |
| 101 | + ]); |
| 102 | + |
| 103 | + $project = $this->getProject([ |
| 104 | + 'footer_link' => [ |
| 105 | + 'href' => 'https://github.com/code-lts/doctum', |
| 106 | + 'rel' => 'noreferrer noopener', |
| 107 | + 'target' => '_blank', |
| 108 | + 'before_text' => 'You can edit the configuration', |
| 109 | + 'link_text' => 'on this', // Required if the href key is set |
| 110 | + 'after_text' => 'repository', |
| 111 | + ], |
| 112 | + ]); |
| 113 | + |
| 114 | + $this->assertSame($project->getFooterLink(), [ |
| 115 | + 'href' => 'https://github.com/code-lts/doctum', |
| 116 | + 'target' => '_blank', |
| 117 | + 'rel' => 'noreferrer noopener', |
| 118 | + 'before_text' => 'You can edit the configuration', |
| 119 | + 'link_text' => 'on this', |
| 120 | + 'after_text' => 'repository', |
| 121 | + ]); |
| 122 | + } |
52 | 123 | } |
0 commit comments