Passed
Pull Request — master (#12)
by romain
09:45
created

LocationPostMessageSpec::it_should_build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 44

Duplication

Lines 44
Ratio 100 %

Importance

Changes 0
Metric Value
dl 44
loc 44
rs 9.216
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace spec\Yproximite\Api\Message\Location;
4
5
use PhpSpec\ObjectBehavior;
6
7
use Yproximite\Api\Message\Location\LocationPostMessage;
8
use Yproximite\Api\Message\Location\LocationTranslationMessage;
9
10
class LocationPostMessageSpec extends ObjectBehavior
11
{
12
    function it_is_initializable()
13
    {
14
        $this->shouldHaveType(LocationPostMessage::class);
15
    }
16
17
    function it_should_build()
18
    {
19
        $translation = new LocationTranslationMessage();
20
        $translation->setLocale('en');
21
        $translation->setTitle('Some location');
22
        $translation->setOpeningHours('24/7');
23
24
        $this->setTel('+1 123 456 78 90');
25
        $this->setTel2('+2 456 111 78 90');
26
        $this->setFax('+3 111 222 78 11');
27
        $this->setMail('[email protected]');
28
        $this->setAddress('88 St Patrick St');
29
        $this->setPostalCode('M5T 1V1');
30
        $this->setTown('Toronto');
31
        $this->setCountry('Canada');
32
        $this->setAddressForGoogleMap('88 St Patrick St, Toronto, M5T 1V1, Canada');
33
        $this->setDefaultLocation(true);
34
        $this->setLatitude('43.6527222');
35
        $this->setLongitude('-79.3918831');
36
        $this->addTranslation($translation);
37
38
        $translationData = [
39
            'title'        => 'Some location',
40
            'openingHours' => '24/7',
41
        ];
42
43
        $data = [
44
            'tel'                 => '+1 123 456 78 90',
45
            'tel2'                => '+2 456 111 78 90',
46
            'fax'                 => '+3 111 222 78 11',
47
            'mail'                => '[email protected]',
48
            'address'             => '88 St Patrick St',
49
            'postalCode'          => 'M5T 1V1',
50
            'town'                => 'Toronto',
51
            'country'             => 'Canada',
52
            'addressForGoogleMap' => '88 St Patrick St, Toronto, M5T 1V1, Canada',
53
            'defaultLocation'     => true,
54
            'latitude'            => '43.6527222',
55
            'longitude'           => '-79.3918831',
56
            'translations'        => ['en' => $translationData]
57
        ];
58
59
        $this->build()->shouldReturn($data);
60
    }
61
}
62