mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Improve test coverage.
This commit is contained in:
		| @@ -67,7 +67,7 @@ class ConfigureMappingHandler implements ConfigurationInterface | ||||
|         $specifics      = $config['specifics'] ?? []; | ||||
|         $names          = array_keys($specifics); | ||||
|         foreach ($names as $name) { | ||||
|             if (!\in_array($name, $validSpecifics)) { | ||||
|             if (!\in_array($name, $validSpecifics, true)) { | ||||
|                 continue; | ||||
|             } | ||||
|             $class = config(sprintf('csv.import_specifics.%s', $name)); | ||||
| @@ -109,6 +109,26 @@ class ConfigureMappingHandler implements ConfigurationInterface | ||||
|         return new MessageBag; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Create the "mapper" class that will eventually return the correct data for the user | ||||
|      * to map against. For example: a list of asset accounts. A list of budgets. A list of tags. | ||||
|      * | ||||
|      * @param string $column | ||||
|      * | ||||
|      * @return MapperInterface | ||||
|      * @throws FireflyException | ||||
|      */ | ||||
|     public function createMapper(string $column): MapperInterface | ||||
|     { | ||||
|         $mapperClass = config('csv.import_roles.' . $column . '.mapper'); | ||||
|         $mapperName  = sprintf('FireflyIII\\Import\Mapper\\%s', $mapperClass); | ||||
|         if (!class_exists($mapperName)) { | ||||
|             throw new FireflyException(sprintf('Class "%s" does not exist. Cannot map "%s"', $mapperName, $column)); // @codeCoverageIgnore | ||||
|         } | ||||
|  | ||||
|         return app($mapperName); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * For each column in the configuration of the job, will: | ||||
|      * - validate the role. | ||||
| @@ -327,24 +347,4 @@ class ConfigureMappingHandler implements ConfigurationInterface | ||||
|         $this->attachments  = app(AttachmentHelperInterface::class); | ||||
|         $this->columnConfig = []; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Create the "mapper" class that will eventually return the correct data for the user | ||||
|      * to map against. For example: a list of asset accounts. A list of budgets. A list of tags. | ||||
|      * | ||||
|      * @param string $column | ||||
|      * | ||||
|      * @return MapperInterface | ||||
|      * @throws FireflyException | ||||
|      */ | ||||
|     private function createMapper(string $column): MapperInterface | ||||
|     { | ||||
|         $mapperClass = config('csv.import_roles.' . $column . '.mapper'); | ||||
|         $mapperName  = sprintf('FireflyIII\\Import\Mapper\\%s', $mapperClass); | ||||
|         if (!class_exists($mapperName)) { | ||||
|             throw new FireflyException(sprintf('Class "%s" does not exist. Cannot map "%s"', $mapperName, $column)); // @codeCoverageIgnore | ||||
|         } | ||||
|  | ||||
|         return app($mapperName); | ||||
|     } | ||||
| } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user