Completed
Push — master ( 8865c9...169b65 )
by Christian
03:22
created

AccountNormalizerSpec::it_normalizes_accounts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 9
cp 0
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
crap 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A AccountNormalizerSpec::it_supports_normalizing_accounts() 0 4 1
1
<?php
2
3
namespace spec\Xabbuh\XApi\Serializer\Normalizer;
4
5
use PhpSpec\ObjectBehavior;
6
use Xabbuh\XApi\DataFixtures\AccountFixtures;
7
use Xabbuh\XApi\Model\IRL;
8
use XApi\Fixtures\Json\AccountJsonFixtures;
9
10
class AccountNormalizerSpec extends ObjectBehavior
11
{
12
    function it_is_a_normalizer()
13
    {
14
        $this->shouldHaveType('Symfony\Component\Serializer\Normalizer\NormalizerInterface');
15
    }
16
17
    function it_is_a_denormalizer()
18
    {
19
        $this->shouldHaveType('Symfony\Component\Serializer\Normalizer\DenormalizerInterface');
20
    }
21
22
    function it_supports_normalizing_accounts()
23
    {
24
        $this->supportsNormalization(AccountFixtures::getTypicalAccount())->shouldBe(true);
25
    }
26
27
    function it_denormalizes_accounts()
28
    {
29
        $account = $this->denormalize(array('homePage' => 'https://tincanapi.com', 'name' => 'test'), 'Xabbuh\XApi\Model\Account');
30
31
        $account->shouldBeAnInstanceOf('Xabbuh\XApi\Model\Account');
32
        $account->getHomePage()->equals(IRL::fromString('https://tincanapi.com'))->shouldReturn(true);
33
        $account->getName()->shouldReturn('test');
34
    }
35
36
    function it_supports_denormalizing_accounts()
37
    {
38
        $this->supportsDenormalization(AccountJsonFixtures::getTypicalAccount(), 'Xabbuh\XApi\Model\Account')->shouldBe(true);
39
    }
40
}
41