-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1606 from Blair2004/v4.8.x
V4.8.x
- Loading branch information
Showing
7 changed files
with
47 additions
and
5 deletions.
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
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
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
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,40 @@ | ||
<?php | ||
|
||
namespace Tests\Feature; | ||
|
||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use Illuminate\Support\Facades\Storage; | ||
use Tests\TestCase; | ||
|
||
class TestLanguageFileValidity extends TestCase | ||
{ | ||
/** | ||
* A basic feature test example. | ||
* | ||
* @return void | ||
*/ | ||
public function test_language_validity() | ||
{ | ||
$files = Storage::disk( 'ns' )->allFiles( 'lang' ); | ||
|
||
foreach( $files as $file ) { | ||
$content = file_get_contents( base_path( $file ) ); | ||
|
||
$this->assertTrue( $this->checkValidity( $content ), sprintf( | ||
'The file "%s" is not valid', | ||
$file | ||
) ); | ||
} | ||
} | ||
|
||
private function checkValidity( $content ) | ||
{ | ||
if ( ! empty( $content ) ) { | ||
@json_decode( $content ); | ||
return ( json_last_error() === JSON_ERROR_NONE ); | ||
} | ||
|
||
return false; | ||
} | ||
} |