Total Complexity | 4 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | final class DateCreatedAwareTraitTest extends TestCase |
||
17 | { |
||
18 | /** |
||
19 | * @var DateCreatedAwareFake |
||
20 | */ |
||
21 | private DateCreatedAwareFake $dateCreatedAwareTrait; |
||
22 | |||
23 | public function setUp(): void |
||
24 | { |
||
25 | $this->dateCreatedAwareTrait = new DateCreatedAwareFake(); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Assert that the created date time can be set and returned calling setDateCreated() and getDateCreated(). |
||
30 | */ |
||
31 | public function testSetAndGetDateCreated(): void |
||
32 | { |
||
33 | $this->assertNull($this->dateCreatedAwareTrait->getDateCreated()); |
||
34 | |||
35 | $dateCreated = new \DateTime(); |
||
36 | |||
37 | $this->dateCreatedAwareTrait->setDateCreated($dateCreated); |
||
38 | |||
39 | $this->assertSame($dateCreated, $this->dateCreatedAwareTrait->getDateCreated()); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Assert that the default value returned from hasDateCreated() is false. |
||
44 | */ |
||
45 | public function testHasDateCreatedIsDefaultFalse(): void |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Assert that if a created date has been set, the call to hasDate() will return true. |
||
52 | */ |
||
53 | public function testHasDateCreatedWillReturnTrueWhenDateIsSet(): void |
||
58 | } |
||
59 | } |
||
60 |