Skip to content

Commit ba7d87c

Browse files
Adds unit test for when publication has no titles
Issue: documentacao-e-tarefas/scielo#789 Signed-off-by: Jhon <jhon@lepidus.com.br>
1 parent 687e52b commit ba7d87c

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

tests/ScieloArticleFactoryTest.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ScieloArticleFactoryTest extends DatabaseTestCase
1212
{
1313
private $locale = 'en_US';
1414
private $contextId = 1;
15+
private $sectionId;
1516
private $submissionId;
1617
private $publicationId;
1718
private $title = "eXtreme Programming: A practical guide";
@@ -27,9 +28,9 @@ class ScieloArticleFactoryTest extends DatabaseTestCase
2728
public function setUp(): void
2829
{
2930
parent::setUp();
30-
$sectionId = $this->createSection();
31+
$this->sectionId = $this->createSection();
3132
$this->submissionId = $this->createSubmission();
32-
$this->publicationId = $this->createPublication($sectionId);
33+
$this->publicationId = $this->createPublication($this->sectionId);
3334
$this->submissionAuthors = $this->createAuthors();
3435
$this->statusMessage = __('submission.status.published', [], 'en_US');
3536
$this->addCurrentPublicationToSubmission();
@@ -210,6 +211,24 @@ public function testSubmissionIsArticle(): void
210211
$this->assertTrue($scieloArticle instanceof ScieloArticle);
211212
}
212213

214+
/**
215+
* @group OJS
216+
*/
217+
public function testArticleCreationWhenItHasNoTitles(): void
218+
{
219+
$this->title = null;
220+
$this->submissionId = $this->createSubmission();
221+
$this->publicationId = $this->createPublication($this->sectionId);
222+
$this->submissionAuthors = $this->createAuthors();
223+
$this->addCurrentPublicationToSubmission();
224+
225+
$articleFactory = new ScieloArticleFactory();
226+
$scieloArticle = $articleFactory->createSubmission($this->submissionId, $this->locale);
227+
228+
$this->assertTrue($scieloArticle instanceof ScieloArticle);
229+
$this->assertEquals("", $scieloArticle->getTitle());
230+
}
231+
213232
/**
214233
* @group OJS
215234
*/

0 commit comments

Comments
 (0)