From 75e69073b133c68a7d82e3e222d433c5fa3a971a Mon Sep 17 00:00:00 2001 From: Sebastian Fey Date: Sun, 29 Oct 2023 18:25:42 +0100 Subject: [PATCH] test: Deleted wrong test, add PR no to CHANGELOG Signed-off-by: Sebastian Fey --- CHANGELOG.md | 2 +- lib/Helper/Filter/JSON/FixToolsFilter.php | 2 ++ tests/Unit/Helper/Filter/JSON/FixToolsFilterTest.php | 11 ----------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d27b8fc..0287b21e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ - Hode the button to copy ingredients unless there are some ingredients to copy [#1844](https://github.com/nextcloud/cookbook/pull/1844) @christianlupus - Allow single tool in JSON+LD import, fixes #1641 - [#XXXX](https://github.com/nextcloud/cookbook/pull/1844) @seyfeb + [#1864](https://github.com/nextcloud/cookbook/pull/1844) @seyfeb ### Maintenance - Fix URL of Transifex after upstream subdomain change diff --git a/lib/Helper/Filter/JSON/FixToolsFilter.php b/lib/Helper/Filter/JSON/FixToolsFilter.php index 71405cc1..380622d4 100644 --- a/lib/Helper/Filter/JSON/FixToolsFilter.php +++ b/lib/Helper/Filter/JSON/FixToolsFilter.php @@ -50,6 +50,8 @@ class FixToolsFilter extends AbstractJSONFilter { if (!is_array($json[self::TOOLS])) { $t = trim($json[self::TOOLS]); $t = $this->textCleaner->cleanUp($t, false); + + // Empty string would mean no tools (i.e., empty array) if($t != "") { $tools[] = $t; } diff --git a/tests/Unit/Helper/Filter/JSON/FixToolsFilterTest.php b/tests/Unit/Helper/Filter/JSON/FixToolsFilterTest.php index 0f181bbf..8ce82062 100644 --- a/tests/Unit/Helper/Filter/JSON/FixToolsFilterTest.php +++ b/tests/Unit/Helper/Filter/JSON/FixToolsFilterTest.php @@ -2,7 +2,6 @@ namespace OCA\Cookbook\tests\Unit\Helper\Filter\JSON; -use OCA\Cookbook\Exception\InvalidRecipeException; use OCA\Cookbook\Helper\Filter\JSON\FixToolsFilter; use OCA\Cookbook\Helper\TextCleanupHelper; use OCP\IL10N; @@ -70,14 +69,4 @@ class FixToolsFilterTest extends TestCase { $this->assertEquals($changed, $ret); $this->assertEquals($this->stub, $recipe); } - - public function testApplyString() { - $recipe = $this->stub; - $recipe['tool'] = 'some text'; - - $this->textCleanupHelper->method('cleanUp')->willReturnArgument(0); - $this->expectException(InvalidRecipeException::class); - - $this->dut->apply($recipe); - } }