@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Graze\DataFile\Modify\Compress\CompressionType; |
| 6 | 6 | use League\Flysystem\Adapter\Local; |
| 7 | -use League\Flysystem\Filesystem; |
|
| 8 | 7 | |
| 9 | 8 | class LocalFile extends FileNode implements LocalFileNodeInterface |
| 10 | 9 | { |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Graze\DataFile\Test\Unit\Format; |
| 4 | 4 | |
| 5 | -use Graze\DataFile\Format\FormatAwareInterface; |
|
| 6 | 5 | use Graze\DataFile\Test\Format\FakeFormatAware; |
| 7 | 6 | use Graze\DataFile\Test\TestCase; |
| 8 | 7 | use Mockery as m; |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use Graze\DataFile\Node\FileNode; |
| 10 | 10 | use Graze\DataFile\Node\FileNodeCollection; |
| 11 | 11 | use Graze\DataFile\Test\TestCase; |
| 12 | -use Hamcrest\Core\AllOf; |
|
| 13 | 12 | use Mockery as m; |
| 14 | 13 | |
| 15 | 14 | class MetadataFinderTest extends TestCase |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $file = m::mock(FileNode::class); |
| 26 | 26 | $file->shouldReceive('getMetadata') |
| 27 | - ->andReturn([ |
|
| 28 | - 'name' => 'test', |
|
| 29 | - ]); |
|
| 27 | + ->andReturn([ |
|
| 28 | + 'name' => 'test', |
|
| 29 | + ]); |
|
| 30 | 30 | $collection = new FileNodeCollection(); |
| 31 | 31 | $collection->add($file); |
| 32 | 32 | |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $file = m::mock(FileNode::class); |
| 43 | 43 | $file->shouldReceive('getMetadata') |
| 44 | - ->andReturn([ |
|
| 45 | - 'name' => 'test', |
|
| 46 | - ]); |
|
| 44 | + ->andReturn([ |
|
| 45 | + 'name' => 'test', |
|
| 46 | + ]); |
|
| 47 | 47 | $file2 = m::mock(FileNode::class); |
| 48 | 48 | $file2->shouldReceive('getMetadata') |
| 49 | - ->andReturn([ |
|
| 50 | - 'name' => 'test2', |
|
| 51 | - ]); |
|
| 49 | + ->andReturn([ |
|
| 50 | + 'name' => 'test2', |
|
| 51 | + ]); |
|
| 52 | 52 | $collection = new FileNodeCollection(); |
| 53 | 53 | $collection->add($file); |
| 54 | 54 | $collection->add($file2); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $file = m::mock(FileNode::class); |
| 69 | 69 | $file->shouldReceive('getMetadata') |
| 70 | - ->andReturn(false); |
|
| 70 | + ->andReturn(false); |
|
| 71 | 71 | $collection = new FileNodeCollection(); |
| 72 | 72 | $collection->add($file); |
| 73 | 73 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function findFiles(FileNodeCollectionInterface $files) |
| 31 | 31 | { |
| 32 | - return $files->filter(function (FileNode $file) { |
|
| 32 | + return $files->filter(function(FileNode $file) { |
|
| 33 | 33 | $metadata = $file->getMetadata(); |
| 34 | 34 | if ($metadata) { |
| 35 | 35 | return ($this->filter->matches($file->getMetadata())); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $this->log(LogLevel::INFO, "Merging files in collection $files into: {$target}"); |
| 69 | 69 | |
| 70 | - $filePaths = $files->map(function (LocalFile $item) { |
|
| 70 | + $filePaths = $files->map(function(LocalFile $item) { |
|
| 71 | 71 | return $item->getPath(); |
| 72 | 72 | }); |
| 73 | 73 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | if (!$keepOld) { |
| 107 | 107 | $this->log(LogLevel::DEBUG, "Deleting old files in collection $files"); |
| 108 | - $files->map(function (LocalFile $item) { |
|
| 108 | + $files->map(function(LocalFile $item) { |
|
| 109 | 109 | if ($item->exists()) { |
| 110 | 110 | $item->delete(); |
| 111 | 111 | } |
@@ -51,8 +51,8 @@ |
||
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | 53 | $output = $file->getClone() |
| 54 | - ->setPath($pathInfo['dirname'] . '/' . $outputFileName) |
|
| 55 | - ->setEncoding($encoding); |
|
| 54 | + ->setPath($pathInfo['dirname'] . '/' . $outputFileName) |
|
| 55 | + ->setEncoding($encoding); |
|
| 56 | 56 | |
| 57 | 57 | $cmd = "iconv " . |
| 58 | 58 | ($file->getEncoding() ? "--from-code={$file->getEncoding()} " : '') . |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | $outputFilePath = $pathInfo['dirname'] . '/' . $outputFileName; |
| 89 | 89 | |
| 90 | 90 | $output = $file->getClone() |
| 91 | - ->setPath($outputFilePath); |
|
| 91 | + ->setPath($outputFilePath); |
|
| 92 | 92 | |
| 93 | 93 | $this->log(LogLevel::INFO, "Retrieving the last {lines} from file {file}", [ |
| 94 | 94 | 'lines' => $this->lines, |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | return null; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $commonPath = $this->reduce(function ($commonPath, FileNodeInterface $file) { |
|
| 26 | + $commonPath = $this->reduce(function($commonPath, FileNodeInterface $file) { |
|
| 27 | 27 | if (is_null($commonPath)) { |
| 28 | 28 | return $file->getPath(); |
| 29 | 29 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $process->shouldReceive('isSuccessful')->andReturn(false); |
| 120 | 120 | |
| 121 | 121 | $this->processFactory->shouldReceive('createProcess') |
| 122 | - ->andReturn($process); |
|
| 122 | + ->andReturn($process); |
|
| 123 | 123 | |
| 124 | 124 | $file = new LocalFile(static::$dir . 'failed_find_encoding_process.test'); |
| 125 | 125 | $file->put('random stuff and things 2!'); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $process->shouldReceive('isSuccessful')->andReturn(false); |
| 136 | 136 | |
| 137 | 137 | $this->processFactory->shouldReceive('createProcess') |
| 138 | - ->andReturn($process); |
|
| 138 | + ->andReturn($process); |
|
| 139 | 139 | |
| 140 | 140 | $file = new LocalFile(static::$dir . 'failed_find_encoding_process.test'); |
| 141 | 141 | $file->put('random stuff and things 2!'); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $process->shouldReceive('getOutput')->andReturn('text/plain; charset=utf-8 compressed-encoding=application/lzop; charset=binary; charset=binary'); |
| 154 | 154 | |
| 155 | 155 | $this->processFactory->shouldReceive('createProcess') |
| 156 | - ->andReturn($process); |
|
| 156 | + ->andReturn($process); |
|
| 157 | 157 | |
| 158 | 158 | $file = new LocalFile(static::$dir . 'unknown_compression.test'); |
| 159 | 159 | $file->put('random stuff and things 2!'); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $process->shouldReceive('getOutput')->andReturn('some random stuff with no charset'); |
| 170 | 170 | |
| 171 | 171 | $this->processFactory->shouldReceive('createProcess') |
| 172 | - ->andReturn($process); |
|
| 172 | + ->andReturn($process); |
|
| 173 | 173 | |
| 174 | 174 | $file = new LocalFile(static::$dir . 'unknown_compression.test'); |
| 175 | 175 | $file->put('random stuff and things 2!'); |