Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Richter committed Nov 28, 2024
1 parent 24f9476 commit caf9f4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
10 changes: 6 additions & 4 deletions Classes/Processing/BibEntryConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
];
Expand Down
16 changes: 9 additions & 7 deletions Tests/Unit/Processing/BibEntryProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}

/**
Expand All @@ -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']);
}

/**
Expand All @@ -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']);
}

/**
Expand All @@ -274,7 +276,7 @@ public function articleFooterIsProcessedCorrectly(): void
$this->pages
);

self::assertEquals($article['tx_lisztcommon_footer'], $expected);
self::assertEquals($expected, $article['tx_lisztcommon_footer']);
}


Expand Down

0 comments on commit caf9f4e

Please sign in to comment.