Skip to content

Commit

Permalink
Merge pull request #10 from thoth-pub/stable-3_4_0
Browse files Browse the repository at this point in the history
Realease/v0.2.1.2
  • Loading branch information
thiagolepidus authored Oct 21, 2024
2 parents 2b8d5c4 + 232dc7e commit 3aa5d5e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
8 changes: 6 additions & 2 deletions classes/services/ThothWorkService.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public function getDataBySubmission($submission, $publication = null)
$data['subtitle'] = $publication->getLocalizedData('subtitle');
$data['longAbstract'] = $publication->getLocalizedData('abstract');
$data['edition'] = $publication->getData('version');
$data['doi'] = $publication->getDoi();
$data['doi'] = $publication->getData('doiObject')
? $publication->getData('doiObject')->getResolvingUrl()
: null;
$data['publicationDate'] = $publication->getData('datePublished');
$data['license'] = $publication->getData('licenseUrl');
$data['copyrightHolder'] = $publication->getLocalizedData('copyrightHolder');
Expand Down Expand Up @@ -80,7 +82,9 @@ public function newByChapter($chapter)
$params['pageCount'] = $chapter->getPages() ? (int) $chapter->getPages() : null;
$params['publicationDate'] = $chapter->getDatePublished() ??
Repo::publication()->get($chapter->getData('publicationId'))->getData('datePublished');
$params['doi'] = $chapter->getDoi();
$params['doi'] = $chapter->getData('doiObject')
? $chapter->getData('doiObject')->getResolvingUrl()
: null;

return $this->new($params);
}
Expand Down
28 changes: 21 additions & 7 deletions tests/classes/services/ThothWorkServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,16 @@ public function testCreateNewWorkBySubmission()
->shouldReceive('getData')
->with('licenseUrl')
->andReturn('https://creativecommons.org/licenses/by-nc/4.0/')
->shouldReceive('getDoi')
->withAnyArgs()
->andReturn('https://doi.org/10.1234/0000af0000')
->shouldReceive('getData')
->with('doiObject')
->andReturn(
Mockery::mock(\PKP\doi\Doi::class)
->makePartial()
->shouldReceive('getResolvingUrl')
->withAnyArgs()
->andReturn('https://doi.org/10.1234/0000af0000')
->getMock()
)
->getMock()
)
->getMock();
Expand Down Expand Up @@ -264,10 +271,17 @@ public function testCreateNewWorkByChapter()
->andReturn('2024-03-21')
->shouldReceive('getPages')
->withAnyArgs()
->andReturn(27)
->shouldReceive('getDoi')
->withAnyArgs()
->andReturn('https://doi.org/10.1234/jpk.14.c54')
->andReturn('27')
->shouldReceive('getData')
->with('doiObject')
->andReturn(
Mockery::mock(\PKP\doi\Doi::class)
->makePartial()
->shouldReceive('getResolvingUrl')
->withAnyArgs()
->andReturn('https://doi.org/10.1234/jpk.14.c54')
->getMock()
)
->getMock();

$thothWork = $this->workService->newByChapter($chapterMock);
Expand Down
2 changes: 1 addition & 1 deletion version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<version>
<application>thoth</application>
<type>plugins.generic</type>
<release>0.2.1.1</release>
<release>0.2.1.2</release>
<date>2024-10-21</date>
<lazy-load>1</lazy-load>
<class>ThothPlugin</class>
Expand Down

0 comments on commit 3aa5d5e

Please sign in to comment.