Skip to content

Commit c61c858

Browse files
committed
Add CouponCode struct
1 parent 9895865 commit c61c858

File tree

4 files changed

+158
-1
lines changed

4 files changed

+158
-1
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapStruct\Struct\CouponList;
6+
7+
/**
8+
* Represents an Evalanche CouponList profile coupon
9+
*/
10+
class ProfileCoupon implements ProfileCouponInterface
11+
{
12+
/** @var int internal id (readonly) */
13+
public $id = 0;
14+
15+
/** @var string The actual coupon code */
16+
public $code;
17+
18+
/** @var int The associated profile id */
19+
public $profileId;
20+
21+
/** @var int The creation date */
22+
public $creationDate;
23+
24+
/** @var int The expiration date (readonly) */
25+
public $validTo = 0;
26+
27+
public function __construct(
28+
string $code = '',
29+
int $profileId = 0,
30+
int $creationDate = 0
31+
) {
32+
$this->code = $code;
33+
$this->profileId = $profileId;
34+
$this->creationDate = $creationDate;
35+
}
36+
37+
public function getId(): int
38+
{
39+
return $this->id;
40+
}
41+
42+
public function getCode(): string
43+
{
44+
return $this->code;
45+
}
46+
47+
public function setCode(string $code): ProfileCouponInterface
48+
{
49+
$this->code = $code;
50+
51+
return $this;
52+
}
53+
54+
public function getProfileId(): int
55+
{
56+
return $this->profileId;
57+
}
58+
59+
public function setProfileId(int $profileId): ProfileCouponInterface
60+
{
61+
$this->profileId = $profileId;
62+
63+
return $this;
64+
}
65+
66+
public function getCreationDate(): int
67+
{
68+
return $this->creationDate;
69+
}
70+
71+
public function setCreationDate(int $creationDate): ProfileCouponInterface
72+
{
73+
$this->creationDate = $creationDate;
74+
75+
return $this;
76+
}
77+
78+
public function getValidTo(): int
79+
{
80+
return $this->validTo;
81+
}
82+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Scn\EvalancheSoapStruct\Struct\CouponList;
4+
5+
use Scn\EvalancheSoapStruct\Struct\StructInterface;
6+
7+
/**
8+
* Represents an Evalanche CouponList profile coupon
9+
*/
10+
interface ProfileCouponInterface extends StructInterface
11+
{
12+
public function getId(): int;
13+
14+
public function getCode(): string;
15+
16+
public function setCode(string $code): ProfileCouponInterface;
17+
18+
public function getProfileId(): int;
19+
20+
public function setProfileId(int $profileId): ProfileCouponInterface;
21+
22+
public function getCreationDate(): int;
23+
24+
public function setCreationDate(int $creationDate): ProfileCouponInterface;
25+
26+
public function getValidTo(): int;
27+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapStruct\Struct\CouponList;
6+
7+
use Scn\EvalancheSoapStruct\GenericSetterGetterTestCase;
8+
9+
class ProfileCouponTest extends GenericSetterGetterTestCase
10+
{
11+
/** @var ProfileCoupon|null */
12+
private $subject;
13+
14+
public function setUp(): void
15+
{
16+
$this->subject = new ProfileCoupon();
17+
}
18+
19+
public function methodDataProvider(): array
20+
{
21+
return [
22+
['Code', 'string'],
23+
['ProfileId', 'int'],
24+
['CreationDAte', 'int'],
25+
];
26+
}
27+
28+
protected function getSubject()
29+
{
30+
return $this->subject;
31+
}
32+
33+
public function testGetValidToReturnsValue(): void
34+
{
35+
$this->assertSame(
36+
0,
37+
$this->subject->getValidTo()
38+
);
39+
}
40+
41+
public function testGetIdReturnsValue(): void
42+
{
43+
$this->assertSame(
44+
0,
45+
$this->subject->getId()
46+
);
47+
}
48+
}

tests/Struct/MailingTemplate/MailingTemplatesSourcesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function methodDataProvider(): array
2727
['TemplateLandingpage', 'string']
2828
];
2929
}
30-
30+
3131
protected function getSubject()
3232
{
3333
return $this->subject;

0 commit comments

Comments
 (0)