Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
yaza-putu committed Jul 10, 2022
2 parents 183c8c6 + dd72bfd commit da975b1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/helpers/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace LaravelEasyRepository\helpers;


use function League\Flysystem\Local\ensureDirectoryExists;

class Search
{
/**
Expand All @@ -12,6 +14,9 @@ class Search
* @return array [SplFileInfo]
*/
static function file($folder, $pattern_array) {
// check directory exsist
ensureDirectoryExists($folder);

$return = array();
$iti = new \RecursiveDirectoryIterator($folder);
foreach(new \RecursiveIteratorIterator($iti) as $file){
Expand Down
25 changes: 25 additions & 0 deletions tests/Unit/FolderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php


namespace LaravelEasyRepository\Tests\Unit;


use LaravelEasyRepository\Tests\TestCase;
class FolderTest extends TestCase
{

/**
* @group folder_test
*/
public function test_folder_repository()
{
$folder_exist = false;
if(file_exists($this->app->basePath()."/".config("easy-repository.repository_directory"))) {
$folder_exist = true;
} else {
$folder_exist = false;
}

$this->assertEquals(true, $folder_exist);
}
}

0 comments on commit da975b1

Please sign in to comment.