Skip to content

Commit

Permalink
Add tests to prove that nullable reference or shasum in Dist will cau…
Browse files Browse the repository at this point in the history
…se the object hydration to fail
  • Loading branch information
jdrieghe committed Jan 26, 2022
1 parent 233caf6 commit 82a7266
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/Packagist/Api/Result/Package/DistSpec.php
Expand Up @@ -43,4 +43,28 @@ public function it_gets_shasum()
{
$this->getShasum()->shouldReturn('cb0a489db41707d5df078f1f35e028e04ffd9e8e');
}

public function it_can_deal_with_nullable_reference()
{
$this->fromArray([
'type' => 'git',
'url' => 'https://github.com/Sylius/Sylius.git',
'reference' => null,
'shasum' => 'cb0a489db41707d5df078f1f35e028e04ffd9e8e',
]);

$this->getReference()->shouldReturn(null);
}

public function it_can_deal_with_nullable_shasum()
{
$this->fromArray([
'type' => 'git',
'url' => 'https://github.com/Sylius/Sylius.git',
'reference' => 'cb0a489db41707d5df078f1f35e028e04ffd9e8e',
'shasum' => null,
]);

$this->getShasum()->shouldReturn(null);
}
}

0 comments on commit 82a7266

Please sign in to comment.