From caf9f4e3ba8217d79e5b443eaa9306bd8019f5a8 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Thu, 28 Nov 2024 13:35:36 +0100 Subject: [PATCH] Fix tests --- Classes/Processing/BibEntryConfig.php | 10 ++++++---- Tests/Unit/Processing/BibEntryProcessorTest.php | 16 +++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Classes/Processing/BibEntryConfig.php b/Classes/Processing/BibEntryConfig.php index 6532ba5..33a84d5 100644 --- a/Classes/Processing/BibEntryConfig.php +++ b/Classes/Processing/BibEntryConfig.php @@ -126,9 +126,9 @@ class BibEntryConfig ]; const NUMBER_OF_VOLUMES = [ 'field' => 'numberOfVolumes', - 'conditionField' => 'pages', + 'conditionField' => 'numberOfVolumes', 'conditionValue' => '', - 'conditionRelation' => 'neq' + 'conditionRelation' => 'neq', ]; public static function getAuthorHeader(): array @@ -161,10 +161,10 @@ public static function getBookSectionFooter(): array { return [ self::circumfix(self::BOOK_TITLE, 'In ', ', '), - self::circumfix(self::VOLUME, 'Bd. ', ', '), - self::postfix(self::NUMBER_OF_VOLUMES, 'Bde., '), self::circumfix(self::EDITOR, 'hg. von ', ', '), self::circumfix(self::TRANSLATOR, 'übers. von ', ', '), + self::postfix(self::NUMBER_OF_VOLUMES, 'Bde., '), + self::circumfix(self::VOLUME, 'Bd. ', ', '), self::postfix(self::PLACE, ' '), self::postfix(self::DATE, ', '), self::PAGES @@ -176,6 +176,8 @@ public static function getBookFooter(): array return [ self::circumfix(self::EDITOR, 'hg. von ', ', '), self::circumfix(self::TRANSLATOR, 'übers. von ', ', '), + self::postfix(self::NUMBER_OF_VOLUMES, 'Bde., '), + self::circumfix(self::VOLUME, 'Bd. ', ', '), self::postfix(self::PLACE, ' '), self::DATE ]; diff --git a/Tests/Unit/Processing/BibEntryProcessorTest.php b/Tests/Unit/Processing/BibEntryProcessorTest.php index 6fb1368..08f7437 100644 --- a/Tests/Unit/Processing/BibEntryProcessorTest.php +++ b/Tests/Unit/Processing/BibEntryProcessorTest.php @@ -219,9 +219,9 @@ public function bodyIsProcessedCorrectly(): void $bookSection = $this->subject->process($this->exampleBookSectionArray, new Collection(), new Collection()); $article = $this->subject->process($this->exampleArticleArray, new Collection(), new Collection()); - self::assertEquals($book['tx_lisztcommon_body'], Str::of($this->title)); - self::assertEquals($bookSection['tx_lisztcommon_body'], Str::of($this->title)); - self::assertEquals($article['tx_lisztcommon_body'], Str::of($this->title)); + self::assertEquals(Str::of($this->title), $book['tx_lisztcommon_body']); + self::assertEquals(Str::of($this->title), $bookSection['tx_lisztcommon_body']); + self::assertEquals(Str::of($this->title), $article['tx_lisztcommon_body']); } /** @@ -233,12 +233,13 @@ public function bookFooterIsProcessedCorrectly(): void $expected = Str::of( 'hg. von ' . $this->editorFirstName . ' ' . $this->editorLastName . ', ' . 'übers. von ' . $this->translatorFirstName . ' ' . $this->translatorLastName . ', ' . + $this->numberOfVolumes . 'Bde., ' . 'Bd. ' . $this->volume . ', ' . $this->place . ' ' . $this->date ); - self::assertEquals($book['tx_lisztcommon_footer'], $expected); + self::assertEquals($expected, $book['tx_lisztcommon_footer']); } /** @@ -249,15 +250,16 @@ public function bookSectionFooterIsProcessedCorrectly(): void $bookSection = $this->subject->process($this->exampleBookSectionArray, new Collection(), new Collection()); $expected = Str::of( 'In ' . $this->bookTitle . ', ' . - 'Bd. ' . $this->volume . ', ' . 'hg. von ' . $this->editorFirstName . ' ' . $this->editorLastName . ', ' . 'übers. von ' . $this->translatorFirstName . ' ' . $this->translatorLastName . ', ' . + $this->numberOfVolumes . 'Bde., ' . + 'Bd. ' . $this->volume . ', ' . $this->place . ' ' . $this->date . ', ' . $this->pages ); - self::assertEquals($bookSection['tx_lisztcommon_footer'], $expected); + self::assertEquals($expected, $bookSection['tx_lisztcommon_footer']); } /** @@ -274,7 +276,7 @@ public function articleFooterIsProcessedCorrectly(): void $this->pages ); - self::assertEquals($article['tx_lisztcommon_footer'], $expected); + self::assertEquals($expected, $article['tx_lisztcommon_footer']); }