-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCandidateProviderTest.php
More file actions
151 lines (129 loc) · 3.36 KB
/
CandidateProviderTest.php
File metadata and controls
151 lines (129 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
declare(strict_types=1);
/**
* This file is part of fast-forward/dev-tools.
*
* This source file is subject to the license bundled
* with this source code in the file LICENSE.
*
* @copyright Copyright (c) 2026 Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
* @license https://opensource.org/licenses/MIT MIT License
*
* @see https://github.com/php-fast-forward/dev-tools
* @see https://github.com/php-fast-forward
* @see https://datatracker.ietf.org/doc/html/rfc2119
*/
namespace FastForward\DevTools\Tests\GitAttributes;
use FastForward\DevTools\GitAttributes\CandidateProvider;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
#[CoversClass(CandidateProvider::class)]
final class CandidateProviderTest extends TestCase
{
private CandidateProvider $provider;
/**
* @return void
*/
protected function setUp(): void
{
$this->provider = new CandidateProvider();
}
/**
* @return void
*/
#[Test]
public function foldersWillReturnNonEmptyArray(): void
{
self::assertNotEmpty($this->provider->folders());
}
/**
* @return void
*/
#[Test]
public function foldersWillStartWithSlash(): void
{
self::assertStringStartsWith('/', $this->provider->folders()[0]);
}
/**
* @return void
*/
#[Test]
public function foldersWillEndWithSlash(): void
{
$folders = $this->provider->folders();
self::assertStringEndsWith('/', $folders[0]);
}
/**
* @return void
*/
#[Test]
public function filesWillReturnNonEmptyArray(): void
{
self::assertNotEmpty($this->provider->files());
}
/**
* @return void
*/
#[Test]
public function filesWillStartWithSlash(): void
{
self::assertStringStartsWith('/', $this->provider->files()[0]);
}
/**
* @return void
*/
#[Test]
public function filesWillNotEndWithSlash(): void
{
$files = $this->provider->files();
self::assertStringEndsNotWith('/', $files[0]);
}
/**
* @return void
*/
#[Test]
public function allWillCombineFoldersAndFiles(): void
{
self::assertCount(
\count($this->provider->folders()) + \count($this->provider->files()),
$this->provider->all(),
);
}
/**
* @return void
*/
#[Test]
public function allWillHaveFoldersFirst(): void
{
$all = $this->provider->all();
$foldersCount = \count($this->provider->folders());
self::assertSame($this->provider->folders(), \array_slice($all, 0, $foldersCount));
}
/**
* @return void
*/
#[Test]
public function allWillHaveFilesAfterFolders(): void
{
$all = $this->provider->all();
$foldersCount = \count($this->provider->folders());
self::assertSame($this->provider->files(), \array_slice($all, $foldersCount));
}
/**
* @return void
*/
#[Test]
public function folderWillContainDotGithub(): void
{
self::assertContains('/.github/', $this->provider->folders());
}
/**
* @return void
*/
#[Test]
public function filesWillContainGitignore(): void
{
self::assertContains('/.gitignore', $this->provider->files());
}
}