diff --git a/Classes/Processing/BibEntryConfig.php b/Classes/Processing/BibEntryConfig.php index bcf4c0c..33a84d5 100644 --- a/Classes/Processing/BibEntryConfig.php +++ b/Classes/Processing/BibEntryConfig.php @@ -124,6 +124,12 @@ class BibEntryConfig 'conditionValue' => '', 'conditionRelation' => 'neq', ]; + const NUMBER_OF_VOLUMES = [ + 'field' => 'numberOfVolumes', + 'conditionField' => 'numberOfVolumes', + 'conditionValue' => '', + 'conditionRelation' => 'neq', + ]; public static function getAuthorHeader(): array { @@ -155,9 +161,10 @@ public static function getBookSectionFooter(): array { return [ self::circumfix(self::BOOK_TITLE, 'In ', ', '), - self::postfix(self::VOLUME, ', '), 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 @@ -169,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 47b0d8f..08f7437 100644 --- a/Tests/Unit/Processing/BibEntryProcessorTest.php +++ b/Tests/Unit/Processing/BibEntryProcessorTest.php @@ -28,12 +28,15 @@ final class BibEntryProcessorTest extends UnitTestCase private string $authorLastName = 'ex_author_last'; private string $editorFirstName = 'ex_editor_first'; private string $editorLastName = 'ex_editor_last'; + private string $translatorFirstName = 'ex_translator_first'; + private string $translatorLastName = 'ex_translator_last'; private string $title = 'ex_title'; private string $bookTitle = 'ex_book_title'; private string $place = 'ex_place'; private string $date = 'ex_date'; private string $pages = 'ex_pages'; private string $volume = 'ex_volume'; + private string $numberOfVolumes = 'ex_number_of_volumes'; private string $issue = 'ex_issue'; private string $exampleBook = ''; @@ -57,9 +60,21 @@ protected function setUp(): void "creatorType": "author", "firstName": "$this->authorFirstName", "lastName": "$this->authorLastName" + }, + { + "creatorType": "editor", + "firstName": "$this->editorFirstName", + "lastName": "$this->editorLastName" + }, + { + "creatorType": "translator", + "firstName": "$this->translatorFirstName", + "lastName": "$this->translatorLastName" } ], "place": "$this->place", + "volume": "$this->volume", + "numberOfVolumes": "$this->numberOfVolumes", "date": "$this->date" } JSON; @@ -75,8 +90,15 @@ protected function setUp(): void "creatorType": "editor", "firstName": "$this->editorFirstName", "lastName": "$this->editorLastName" + }, + { + "creatorType": "translator", + "firstName": "$this->translatorFirstName", + "lastName": "$this->translatorLastName" } ], + "volume": "$this->volume", + "numberOfVolumes": "$this->numberOfVolumes", "place": "$this->place", "date": "$this->date" } @@ -137,9 +159,16 @@ protected function setUp(): void "creatorType": "editor", "firstName": "$this->editorFirstName", "lastName": "$this->editorLastName" + }, + { + "creatorType": "translator", + "firstName": "$this->translatorFirstName", + "lastName": "$this->translatorLastName" } ], "bookTitle": "$this->bookTitle", + "volume": "$this->volume", + "numberOfVolumes": "$this->numberOfVolumes", "place": "$this->place", "date": "$this->date", "pages": "$this->pages" @@ -190,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']); } /** @@ -201,9 +230,16 @@ public function bodyIsProcessedCorrectly(): void public function bookFooterIsProcessedCorrectly(): void { $book = $this->subject->process($this->exampleBookArray, new Collection(), new Collection()); - $expected = Str::of($this->place . ' ' . $this->date); + $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']); } /** @@ -212,10 +248,18 @@ public function bookFooterIsProcessedCorrectly(): void public function bookSectionFooterIsProcessedCorrectly(): void { $bookSection = $this->subject->process($this->exampleBookSectionArray, new Collection(), new Collection()); - $expected = Str::of('In ' . $this->bookTitle . ', ' . 'hg. von ' . $this->editorFirstName . ' ' . $this->editorLastName . - ', ' . $this->place . ' ' . $this->date . ', ' . $this->pages); + $expected = Str::of( + 'In ' . $this->bookTitle . ', ' . + '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']); } /** @@ -224,10 +268,15 @@ public function bookSectionFooterIsProcessedCorrectly(): void public function articleFooterIsProcessedCorrectly(): void { $article = $this->subject->process($this->exampleArticleArray, new Collection(), new Collection()); - $expected = Str::of($this->bookTitle . ' ' . $this->volume . ' (' . $this->date . '), Nr. ' . $this->issue . ', ' . $this->pages); - var_dump($article['tx_lisztcommon_footer']); + $expected = Str::of( + $this->bookTitle . ' ' . + $this->volume . + ' (' . $this->date . '), Nr. ' . + $this->issue . ', ' . + $this->pages + ); - self::assertEquals($article['tx_lisztcommon_footer'], $expected); + self::assertEquals($expected, $article['tx_lisztcommon_footer']); }