mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Fix unit tests.
This commit is contained in:
		| @@ -65,7 +65,9 @@ class CreateExport extends Command | ||||
|     /** | ||||
|      * Execute the console command. | ||||
|      * | ||||
|      * @return mixed | ||||
|      * @return int | ||||
|      * @SuppressWarnings(PHPMD.CyclomaticComplexity) | ||||
|      * @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||||
|      */ | ||||
|     public function handle(): int | ||||
|     { | ||||
|   | ||||
| @@ -51,8 +51,12 @@ class DecryptAttachment extends Command | ||||
|  | ||||
|     /** | ||||
|      * Execute the console command. | ||||
|      * @SuppressWarnings(PHPMD.CyclomaticComplexity) | ||||
|      * @SuppressWarnings(PHPMD.ExcessiveMethodLength) | ||||
|      * | ||||
|      * @return int | ||||
|      */ | ||||
|     public function handle(): void | ||||
|     public function handle(): int | ||||
|     { | ||||
|         /** @var AttachmentRepositoryInterface $repository */ | ||||
|         $repository     = app(AttachmentRepositoryInterface::class); | ||||
| @@ -64,28 +68,28 @@ class DecryptAttachment extends Command | ||||
|             $this->error(sprintf('No attachment with id #%d', $attachmentId)); | ||||
|             Log::error(sprintf('DecryptAttachment: No attachment with id #%d', $attachmentId)); | ||||
|  | ||||
|             return; | ||||
|             return 1; | ||||
|         } | ||||
|  | ||||
|         if ($attachmentName !== $attachment->filename) { | ||||
|             $this->error('File name does not match.'); | ||||
|             Log::error('DecryptAttachment: File name does not match.'); | ||||
|  | ||||
|             return; | ||||
|             return 1; | ||||
|         } | ||||
|  | ||||
|         if (!is_dir($storagePath)) { | ||||
|             $this->error(sprintf('Path "%s" is not a directory.', $storagePath)); | ||||
|             Log::error(sprintf('DecryptAttachment: Path "%s" is not a directory.', $storagePath)); | ||||
|  | ||||
|             return; | ||||
|             return 1; | ||||
|         } | ||||
|  | ||||
|         if (!is_writable($storagePath)) { | ||||
|             $this->error(sprintf('Path "%s" is not writable.', $storagePath)); | ||||
|             Log::error(sprintf('DecryptAttachment: Path "%s" is not writable.', $storagePath)); | ||||
|  | ||||
|             return; | ||||
|             return 1; | ||||
|         } | ||||
|  | ||||
|         $fullPath = $storagePath . DIRECTORY_SEPARATOR . $attachment->filename; | ||||
| @@ -95,9 +99,10 @@ class DecryptAttachment extends Command | ||||
|         if (false === $result) { | ||||
|             $this->error('Could not write to file.'); | ||||
|  | ||||
|             return; | ||||
|             return 1; | ||||
|         } | ||||
|         $this->info(sprintf('%d bytes written. Exiting now..', $result)); | ||||
|  | ||||
|         return 0; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user