File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ final class Sent implements Response
15
15
public function __construct (
16
16
public readonly string $ id ,
17
17
public readonly string $ from ,
18
- public readonly string $ to
18
+ public readonly string $ to ,
19
+ public readonly string $ createdAt
19
20
) {
20
21
//
21
22
}
@@ -28,7 +29,8 @@ public static function from(array $attributes): self
28
29
return new self (
29
30
$ attributes ['id ' ],
30
31
$ attributes ['from ' ],
31
- $ attributes ['to ' ]
32
+ $ attributes ['to ' ],
33
+ $ attributes ['created_at ' ]
32
34
);
33
35
}
34
36
@@ -41,6 +43,7 @@ public function toArray(): array
41
43
'id ' => $ this ->id ,
42
44
'from ' => $ this ->from ,
43
45
'to ' => $ this ->to ,
46
+ 'created_at ' => $ this ->createdAt ,
44
47
];
45
48
}
46
49
}
Original file line number Diff line number Diff line change @@ -6,5 +6,6 @@ function email(): array
6
6
'id ' => '49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ' ,
7
7
8
8
9
+ 'created_at ' => '2022-07-25T00:28:32.493138+00:00 ' ,
9
10
];
10
11
}
Original file line number Diff line number Diff line change 13
13
test ('as array accessible ' , function () {
14
14
$ email = Sent::from (email ());
15
15
16
- expect ($ email ['id ' ])->toBe ('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ' );
16
+ expect ($ email ['id ' ])->toBe ('49a3999c-0ce1-4ea6-ab68-afcd6dc2e794 ' )
17
+ ->and (isset ($ email ['created_at ' ]))->toBeTrue ()
18
+ ->and ($ email ['created_at ' ])->toBe ('2022-07-25T00:28:32.493138+00:00 ' );
17
19
});
18
20
19
21
test ('to array ' , function () {
You can’t perform that action at this time.
0 commit comments