Skip to content

Commit

Permalink
Add unit tests and according code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Richter committed Mar 4, 2024
1 parent e766bec commit 868532e
Show file tree
Hide file tree
Showing 4 changed files with 560 additions and 32 deletions.
39 changes: 9 additions & 30 deletions Classes/Domain/Model/PublishedItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function setMvdbId(): void
$this->mvdbId = $this->publisher->getShorthand() .
'_' . $minPlateId;

Collection::wrap($this->publishedSubitems)->
Collection::wrap($this->publishedSubitems->toArray())->
each( function($subitem) { $this->setSubitemMvdbId($subitem); } );
}

Expand Down Expand Up @@ -364,7 +364,7 @@ public function setInstrumentation($instrumentation): void
*
* @return \Slub\MpdbCore\Domain\Model\Publisher $publisher
*/
public function getPublisher(): Publisher
public function getPublisher(): ?Publisher
{
return $this->publisher;
}
Expand Down Expand Up @@ -699,7 +699,7 @@ public function isContainedWorksIdentified(): bool
*
* @return string $responsiblePerson
*/
public function getResponsiblePerson(): GndPerson
public function getResponsiblePerson(): string
{
return $this->responsiblePerson;
}
Expand All @@ -710,32 +710,11 @@ public function getResponsiblePerson(): GndPerson
* @param string $responsiblePerson
* @return void
*/
public function setResponsiblePerson(GndPerson $responsiblePerson): void
public function setResponsiblePerson(string $responsiblePerson): void
{
$this->responsiblePerson = $responsiblePerson;
}

/**
* Returns the dateOfPublishing
*
* @return \DateTime $dateOfPublishing
*/
public function getDateOfPublishing(): \DateTime
{
return $this->dateOfPublishing;
}

/**
* Sets the dateOfPublishing
*
* @param \DateTime $dateOfPublishing
* @return void
*/
public function setDateOfPublishing(\DateTime $dateOfPublishing): void
{
$this->dateOfPublishing = $dateOfPublishing;
}

/**
* Returns the mvdbId
*
Expand Down Expand Up @@ -820,7 +799,7 @@ public function removeForm(Genre $formToRemove): void
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Slub\DmOnt\Domain\Model\Genre> form
*/
public function getForm(): Genre
public function getGenre(): ObjectStorage
{
return $this->form;
}
Expand All @@ -831,7 +810,7 @@ public function getForm(): Genre
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Slub\DmOnt\Domain\Model\Genre> $form
* @return void
*/
public function setForm(ObjectStorage $form): void
public function setGenre(ObjectStorage $form): void
{
$this->form = $form;
}
Expand Down Expand Up @@ -892,10 +871,10 @@ public function getFinal(): int
/**
* Sets the final
*
* @param bool $final
* @param int $final
* @return void
*/
public function setFinal(bool $final): void
public function setFinal(int $final): void
{
$this->final = $final;
Collection::wrap($this->getContainedWorks()->toArray())->
Expand Down Expand Up @@ -1009,7 +988,7 @@ protected static function getWorkComposerName(GndWork $work): string
*/
public function getPlateIds(): Collection
{
return Collection::wrap($this->publishedSubitems)->
return Collection::wrap($this->publishedSubitems->toArray())->
map( function($subitem) { return self::getSubitemPlateId($subitem); } );
}

Expand Down
Loading

0 comments on commit 868532e

Please sign in to comment.