-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b524f51
commit e7b8558
Showing
5 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
'', | ||
'f@issa!oux', | ||
'pest', | ||
'plugin inside', | ||
'plugin', | ||
'inside', | ||
'duplicate', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
'', | ||
'f@issa!oux', | ||
'pest', | ||
'plugin inside', | ||
'plugin', | ||
'inside', | ||
'duplicate', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
return [ | ||
'', | ||
'f@issa!oux', | ||
'pest plugin', | ||
'pest plugin inside', | ||
'pest', | ||
'plugin', | ||
'inside', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\ExpectationFailedException; | ||
|
||
it('passes', function (): void { | ||
expect('tests/Fixtures/returnsMultipleDuplicates.php') | ||
->toReturnSingleWords(); | ||
}); | ||
|
||
it('passes with not', function (): void { | ||
expect('tests/Fixtures/returnsUnique.php') | ||
->not->toReturnSingleWords(); | ||
}); | ||
|
||
it('passes when directory is empty', function (): void { | ||
expect('tests/Fixtures/empty') | ||
->toReturnSingleWords(); | ||
}); | ||
|
||
it('passes when all directory files content are single words', function (): void { | ||
expect('tests/Fixtures/directory') | ||
->toReturnSingleWords(depth: 0); | ||
}); | ||
|
||
it('fails', function (): void { | ||
expect('tests/Fixtures/returnsUnique.php') | ||
->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class); | ||
|
||
it('fails with not', function (): void { | ||
expect('tests/Fixtures/returnsMultipleDuplicates.php') | ||
->not->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class); | ||
|
||
it('fails when file does not exist', function (): void { | ||
expect('tests/Fixtures/notExist.php') | ||
->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class, 'tests/Fixtures/notExist.php not found'); | ||
|
||
it('fails when directory does not exist', function (): void { | ||
expect('tests/Fixtures/notExist') | ||
->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class); | ||
|
||
it('fails when not all directory files content are single words', function (): void { | ||
expect('tests/Fixtures/directory1') | ||
->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class); | ||
|
||
it('fails when not all subdirectories files content are single words', function (): void { | ||
expect('tests/Fixtures/directory') | ||
->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class); | ||
|
||
it('displays word detected', function (): void { | ||
expect('tests/Fixtures/directory')->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class, 'Not single words detected: plugin inside'); | ||
|
||
it('displays multiple not single words detected', function (): void { | ||
expect('tests/Fixtures/returnsDuplicates.php') | ||
->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class, 'pest plugin,pest plugin inside'); | ||
|
||
it('displays file where error detected', function (): void { | ||
expect('tests/Fixtures/directory')->toReturnSingleWords(); | ||
})->throws(ExpectationFailedException::class, 'notAllUnique.php'); |