Skip to content

Commit

Permalink
Define expected behaviour with elife assessment class with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LinaKind committed Dec 5, 2024
1 parent 19f0f4c commit 41b04e6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Model/ElifeAssessment.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ final class ElifeAssessment implements Model
* @internal
*/
public function __construct(
array $significance,
array $strength
array $significance = null,
array $strength = null
) {
$this->significance = $significance;
$this->strength = $strength;
}

public function getSignificance() : array
/**
* @return array|null
*/
public function getSignificance()
{
return $this->significance;
}

public function getStrength() : array
/**
* @return array|null
*/
public function getStrength()
{
return $this->strength;
}
Expand Down
34 changes: 34 additions & 0 deletions test/Model/ElifeAssessmentTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace test\eLife\ApiSdk\Model\Block;

use eLife\ApiSdk\Model\ElifeAssessment;
use PHPUnit\Framework\TestCase;

final class ElifeAssessmentTest extends TestCase
{

/**
* @test
*/
public function it_may_have_significance_terms()
{
$with = new ElifeAssessment(['important'], ['solid']);
$withOut = new ElifeAssessment(null, ['solid']);

$this->assertSame(['important'], $with->getSignificance());
$this->assertNull($withOut->getSignificance());
}

/**
* @test
*/
public function it_may_have_strength_terms()
{
$with = new ElifeAssessment(['important'], ['solid']);
$withOut = new ElifeAssessment(['important']);

$this->assertSame(['solid'], $with->getStrength());
$this->assertNull($withOut->getStrength());
}
}

0 comments on commit 41b04e6

Please sign in to comment.