Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf 2023-11-16 10:05:31 +01:00
Родитель 8a21d46fa6
Коммит 703ed9d8d3
32 изменённых файлов: 24 добавлений и 55 удалений

Просмотреть файл

@ -5,7 +5,7 @@ namespace OCA\Cookbook\Controller\Implementation;
use OCA\Cookbook\Exception\NoRecipeNameGivenException;
use OCA\Cookbook\Exception\RecipeExistsException;
use OCA\Cookbook\Helper\AcceptHeaderParsingHelper;
use OCA\Cookbook\Helper\Filter\RecipeJSONOutputFilter;
use OCA\Cookbook\Helper\Filter\Output\RecipeJSONOutputFilter;
use OCA\Cookbook\Helper\RestParameterParser;
use OCA\Cookbook\Service\DbCacheService;
use OCA\Cookbook\Service\RecipeService;

Просмотреть файл

@ -1,6 +1,6 @@
<?php
namespace OCA\Cookbook\Helper\Filter;
namespace OCA\Cookbook\Helper\Filter\DB;
use OCA\Cookbook\Exception\InvalidRecipeException;
use OCP\Files\File;

Просмотреть файл

@ -1,8 +1,7 @@
<?php
namespace OCA\Cookbook\Helper\Filter;
namespace OCA\Cookbook\Helper\Filter\DB;
use OCA\Cookbook\Helper\Filter\DB\RecipeDatesFilter;
use OCP\Files\File;
class NormalizeRecipeFileFilter {

Просмотреть файл

@ -3,7 +3,6 @@
namespace OCA\Cookbook\Helper\Filter\DB;
use DateTime;
use OCA\Cookbook\Helper\Filter\AbstractRecipeFilter;
use OCP\Files\File;
/**

Просмотреть файл

@ -1,6 +1,6 @@
<?php
namespace OCA\Cookbook\Helper\Filter;
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Exception\InvalidRecipeException;
use OCP\Files\File;

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\TextCleanupHelper;
/**

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\TextCleanupHelper;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -3,7 +3,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Exception\InvalidDurationException;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\ISO8601DurationHelper;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -3,7 +3,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Exception\InvalidRecipeException;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCP\IL10N;
/**

Просмотреть файл

@ -3,7 +3,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Exception\InvalidRecipeException;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\TextCleanupHelper;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -3,7 +3,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Exception\InvalidRecipeException;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\TextCleanupHelper;
use OCA\Cookbook\Service\JsonService;
use OCP\IL10N;

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\TextCleanupHelper;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -3,7 +3,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Exception\InvalidRecipeException;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\TextCleanupHelper;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -1,22 +1,6 @@
<?php
namespace OCA\Cookbook\Helper\Filter;
use OCA\Cookbook\Helper\Filter\JSON\CleanCategoryFilter;
use OCA\Cookbook\Helper\Filter\JSON\ExtractImageUrlFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixDescriptionFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixDurationsFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixImageSchemeFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixIngredientsFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixInstructionsFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixKeywordsFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixNutritionFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixRecipeYieldFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixToolsFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixUrlFilter;
use OCA\Cookbook\Helper\Filter\JSON\RecipeIdTypeFilter;
use OCA\Cookbook\Helper\Filter\JSON\RecipeNameFilter;
use OCA\Cookbook\Helper\Filter\JSON\SchemaConformityFilter;
namespace OCA\Cookbook\Helper\Filter\JSON;
class JSONFilter {
/** @var AbstractJSONFilter[] */

Просмотреть файл

@ -2,8 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
/**
* Copy the id from the recipe_id to the id field if there is no id present so far.
*/

Просмотреть файл

@ -2,8 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
/**
* Fix the data type of the id of a recipe.
*

Просмотреть файл

@ -2,7 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\TextCleanupHelper;
/**

Просмотреть файл

@ -2,8 +2,6 @@
namespace OCA\Cookbook\Helper\Filter\JSON;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
/**
* Make sure the schema.org standard annotations are present in the JSON object.
*/

Просмотреть файл

@ -2,7 +2,7 @@
namespace OCA\Cookbook\Helper\Filter\Output;
use OCA\Cookbook\Helper\Filter\AbstractJSONFilter;
use OCA\Cookbook\Helper\Filter\JSON\AbstractJSONFilter;
use OCP\IL10N;
use Psr\Log\LoggerInterface;

Просмотреть файл

@ -1,8 +1,7 @@
<?php
namespace OCA\Cookbook\Helper\Filter;
namespace OCA\Cookbook\Helper\Filter\Output;
use OCA\Cookbook\Helper\Filter\Output\EnsureNutritionPresentFilter;
use OCP\Files\File;
class RecipeJSONOutputFilter {

Просмотреть файл

@ -1,7 +1,8 @@
<?php
namespace OCA\Cookbook\Helper\Filter;
namespace OCA\Cookbook\Helper\Filter\Output;
use OCA\Cookbook\Helper\Filter\JSON\AbstractJSONFilter;
use OCA\Cookbook\Helper\Filter\JSON\RecipeIdCopyFilter;
use OCA\Cookbook\Helper\Filter\JSON\RecipeIdTypeFilter;

Просмотреть файл

@ -4,7 +4,7 @@ namespace OCA\Cookbook\Service;
use OCA\Cookbook\Db\RecipeDb;
use OCA\Cookbook\Exception\InvalidJSONFileException;
use OCA\Cookbook\Helper\Filter\NormalizeRecipeFileFilter;
use OCA\Cookbook\Helper\Filter\DB\NormalizeRecipeFileFilter;
use OCA\Cookbook\Helper\UserConfigHelper;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\Files\File;

Просмотреть файл

@ -10,7 +10,7 @@ use OCA\Cookbook\Exception\NoRecipeNameGivenException;
use OCA\Cookbook\Exception\RecipeExistsException;
use OCA\Cookbook\Exception\UserFolderNotWritableException;
use OCA\Cookbook\Helper\FileSystem\RecipeNameHelper;
use OCA\Cookbook\Helper\Filter\JSONFilter;
use OCA\Cookbook\Helper\Filter\JSON\JSONFilter;
use OCA\Cookbook\Helper\ImageService\ImageSize;
use OCA\Cookbook\Helper\UserConfigHelper;
use OCA\Cookbook\Helper\UserFolderHelper;

Просмотреть файл

@ -3,7 +3,7 @@
namespace OCA\Cookbook\tests\Integration\Helper\Filter\JSON;
use OCA\Cookbook\AppInfo\Application;
use OCA\Cookbook\Helper\Filter\RecipeStubFilter;
use OCA\Cookbook\Helper\Filter\Output\RecipeStubFilter;
use PHPUnit\Framework\TestCase;
class RecipeFixIdsTest extends TestCase {
@ -30,11 +30,17 @@ class RecipeFixIdsTest extends TestCase {
$expected = $stub;
$expected['recipe_id'] = 123;
$expected['id'] = '123';
yield [$src, $expected];
yield 'only numeric recipe_id' => [$src, $expected];
$src['recipe_id'] = $expected['recipe_id'] = '123';
yield 'only string recipe_id' => [$src, $expected];
$src['id'] = '234';
$expected['id'] = '234';
yield [$src, $expected];
yield 'with string id' => [$src, $expected];
$src['recipe_id'] = $expected['recipe_id'] = 123;
yield 'mixed string and int id recipe_id' => [$src, $expected];
}
/**

Просмотреть файл

@ -7,7 +7,7 @@ use OCA\Cookbook\Controller\Implementation\RecipeImplementation;
use OCA\Cookbook\Exception\NoRecipeNameGivenException;
use OCA\Cookbook\Exception\RecipeExistsException;
use OCA\Cookbook\Helper\AcceptHeaderParsingHelper;
use OCA\Cookbook\Helper\Filter\RecipeJSONOutputFilter;
use OCA\Cookbook\Helper\Filter\Output\RecipeJSONOutputFilter;
use OCA\Cookbook\Helper\RestParameterParser;
use OCA\Cookbook\Service\DbCacheService;
use OCA\Cookbook\Service\RecipeService;

Просмотреть файл

@ -14,10 +14,10 @@ use OCA\Cookbook\Helper\Filter\JSON\FixNutritionFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixRecipeYieldFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixToolsFilter;
use OCA\Cookbook\Helper\Filter\JSON\FixUrlFilter;
use OCA\Cookbook\Helper\Filter\JSON\JSONFilter;
use OCA\Cookbook\Helper\Filter\JSON\RecipeIdTypeFilter;
use OCA\Cookbook\Helper\Filter\JSON\RecipeNameFilter;
use OCA\Cookbook\Helper\Filter\JSON\SchemaConformityFilter;
use OCA\Cookbook\Helper\Filter\JSONFilter;
use PHPUnit\Framework\TestCase;
class JSONFilterTest extends TestCase {

Просмотреть файл

@ -2,8 +2,8 @@
namespace OCA\Cookbook\tests\Unit\Helper\Filter;
use OCA\Cookbook\Helper\Filter\DB\NormalizeRecipeFileFilter;
use OCA\Cookbook\Helper\Filter\DB\RecipeDatesFilter;
use OCA\Cookbook\Helper\Filter\NormalizeRecipeFileFilter;
use OCP\Files\File;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

Просмотреть файл

@ -3,7 +3,7 @@
namespace OCA\Cookbook\tests\Unit\Helper\Filter;
use OCA\Cookbook\Helper\Filter\Output\EnsureNutritionPresentFilter;
use OCA\Cookbook\Helper\Filter\RecipeJSONOutputFilter;
use OCA\Cookbook\Helper\Filter\Output\RecipeJSONOutputFilter;
use PHPUnit\Framework\TestCase;
class RecipeJSONOutputFilterTest extends TestCase {