File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,11 @@ protected function status(): Attribute
47
47
}
48
48
49
49
if ($ this ->accepted === true ) {
50
- return 'Accepted ( ' . date ('d-m ' , strtotime ( $ this -> updated_at ) ) . ') ' ;
50
+ return 'Accepted ( ' . $ this -> updated_at -> format ('d-m ' ) . ') ' ;
51
51
}
52
52
53
53
if ($ this ->accepted === false ) {
54
- return 'Denied ( ' . date ('d-m ' , strtotime ( $ this -> updated_at ) ) . ') ' ;
54
+ return 'Denied ( ' . $ this -> updated_at -> format ('d-m ' ) . ') ' ;
55
55
}
56
56
57
57
return 'Unknown ' ;
Original file line number Diff line number Diff line change 3
3
namespace Tests \Unit \Models ;
4
4
5
5
use App \Models \SpaceInvite ;
6
+ use Carbon \Carbon ;
6
7
use Tests \TestCase ;
7
8
8
9
class SpaceInviteTest extends TestCase
@@ -19,15 +20,17 @@ public function testStatusAttribute(): void
19
20
$ acceptedSpaceInvite = SpaceInvite::factory ()
20
21
->make ([
21
22
'accepted ' => true ,
23
+ 'updated_at ' => Carbon::parse ('2021-02-14 ' ),
22
24
]);
23
25
24
- $ this ->assertStringStartsWith ('Accepted ' , $ acceptedSpaceInvite ->status );
26
+ $ this ->assertEquals ('Accepted (14-02) ' , $ acceptedSpaceInvite ->status );
25
27
26
28
$ deniedSpaceInvite = SpaceInvite::factory ()
27
29
->make ([
28
30
'accepted ' => false ,
31
+ 'updated_at ' => Carbon::parse ('2021-02-14 ' ),
29
32
]);
30
33
31
- $ this ->assertStringStartsWith ('Denied ' , $ deniedSpaceInvite ->status );
34
+ $ this ->assertEquals ('Denied (14-02) ' , $ deniedSpaceInvite ->status );
32
35
}
33
36
}
You can’t perform that action at this time.
0 commit comments