Skip to content

Commit 8e3fbb7

Browse files
authored
Merge pull request #6 from faissaloux/helpers-tests
helpers tests
2 parents 89cac5a + d19222f commit 8e3fbb7

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

src/helpers.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ function getFilesIn(string $directory, int $depth = -1): array
3838
$allFiles[] = $directory.DIRECTORY_SEPARATOR.$file;
3939
}
4040
}
41-
42-
return $allFiles;
4341
}
4442

45-
return [];
43+
return $allFiles;
4644
}

tests/Unit/helpers/isDir.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
uses()->group('helpers');
4+
5+
it('returns true when is dir', function (): void {
6+
expect(isDir('directory'))->toBeTrue();
7+
});
8+
9+
it('returns false when is not dir', function (): void {
10+
expect(isDir('file.php'))->toBeFalse();
11+
});

tests/Unit/helpers/isDirOrPhp.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
uses()->group('helpers');
4+
5+
it('returns true when is dir', function (): void {
6+
expect(isDirOrPhp('directory'))->toBeTrue();
7+
});
8+
9+
it('returns false when is php file', function (): void {
10+
expect(isDirOrPhp('file.php'))->toBeTrue();
11+
});
12+
13+
it('returns false when is not php file', function (): void {
14+
expect(isDirOrPhp('file.js'))->toBeFalse();
15+
});

tests/Unit/helpers/isPhp.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
uses()->group('helpers');
4+
5+
it('returns true when is php file', function (): void {
6+
expect(isPhp('file.php'))->toBeTrue();
7+
});
8+
9+
it('returns false when is not php file', function (): void {
10+
expect(isPhp('file.js'))->toBeFalse();
11+
});
12+
13+
it('returns false when is dir', function (): void {
14+
expect(isPhp('directory'))->toBeFalse();
15+
});

0 commit comments

Comments
 (0)