-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathRepoFilesExistsTest.php
43 lines (39 loc) · 1.2 KB
/
RepoFilesExistsTest.php
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
<?php
use PHPUnit\Framework\TestCase;
class RepoFilesExistsTest extends TestCase
{
private $_requiredFiles;
protected function setUp(): void
{
$this->_requiredFiles = [
'./.env_sample',
'./PULL_REQUEST_TEMPLATE.md',
'./.gitignore',
'./.github/workflows/test-and-deploy.yml',
'./CHANGELOG.md',
'./CODE_OF_CONDUCT.md',
'./CONTRIBUTING.md',
'./LICENSE',
'./README.md',
'./TROUBLESHOOTING.md',
'./USAGE.md',
];
}
public function testFileArePresentInRepo()
{
foreach ($this->_requiredFiles as $filePath) {
if (is_array($filePath)) {
$exists = array_filter(
$filePath,
function ($file) {
return file_exists($file);
}
);
$files = join('" and "', $filePath);
$this->assertNotEmpty($exists, "File \"{$files}\" does not exist in repo!");
} else {
$this->assertFileExists($filePath, "File \"{$filePath}\" does not exist in repo!");
}
}
}
}