1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace spec\Yproximite\Api\Message\Site; |
4
|
|
|
|
5
|
|
|
use PhpSpec\ObjectBehavior; |
6
|
|
|
|
7
|
|
|
use Yproximite\Api\Model\Site\Site; |
8
|
|
|
use Yproximite\Api\Message\Site\SitePatchMessage; |
9
|
|
|
|
10
|
|
|
class SitePatchMessageSpec extends ObjectBehavior |
11
|
|
|
{ |
12
|
|
|
function it_is_initializable() |
13
|
|
|
{ |
14
|
|
|
$this->shouldHaveType(SitePatchMessage::class); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
function it_should_build() |
18
|
|
|
{ |
19
|
|
|
$this->setTitle('Hello world!'); |
20
|
|
|
$this->setDataParentId(5); |
21
|
|
|
$this->setThemeId(1); |
22
|
|
|
$this->setContactEmail('[email protected]'); |
23
|
|
|
$this->setHost('hello-world.com'); |
24
|
|
|
$this->setDefaultLocale('en'); |
25
|
|
|
$this->setCompanyId(1); |
26
|
|
|
$this->setSendRegistrationEmail(true); |
27
|
|
|
$this->setZohoManager('Manager'); |
28
|
|
|
$this->setZohoStatus('Active'); |
29
|
|
|
$this->setBillingStatus(Site::BILLING_STATUS_DIRECT); |
30
|
|
|
$this->setImportRef('12345af'); |
31
|
|
|
|
32
|
|
|
$data = [ |
33
|
|
|
'host' => 'hello-world.com', |
34
|
|
|
]; |
35
|
|
|
|
36
|
|
|
$this->build()->shouldReturn($data); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
function it_should_create_from_site(Site$site) |
40
|
|
|
{ |
41
|
|
|
$site->getId()->willReturn(1); |
42
|
|
|
$site->getHost()->willReturn('test.fr'); |
43
|
|
|
$site->getBillingStatus()->willReturn('test'); |
44
|
|
|
$site->getContactEmail()->willReturn('[email protected]'); |
45
|
|
|
$site->getCompanyId()->willreturn(42); |
46
|
|
|
$site->getThemeId()->willReturn(12); |
47
|
|
|
$site->getTitle()->willreturn('Test'); |
48
|
|
|
|
49
|
|
|
$message = new SitePatchMessage(); |
50
|
|
|
$message->setId(1); |
51
|
|
|
$message->setHost('test.fr'); |
52
|
|
|
$message->setBillingStatus('test'); |
53
|
|
|
$message->setContactEmail('[email protected]'); |
54
|
|
|
$message->setCompanyId(42); |
55
|
|
|
$message->setThemeId(12); |
56
|
|
|
$message->setTitle('Test'); |
57
|
|
|
|
58
|
|
|
$this::createFromSite($site)->shouldBeLike($message); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|