2
2
namespace Madewithlove \IlluminatePsrCacheBridge \Tests \Unit \Laravel ;
3
3
4
4
use Carbon \Carbon ;
5
+ use DateTimeImmutable ;
5
6
use Madewithlove \IlluminatePsrCacheBridge \Laravel \CacheItem ;
6
7
use PHPUnit_Framework_TestCase ;
7
8
use Psr \Cache \CacheItemInterface ;
@@ -45,8 +46,8 @@ public function it_remembers_its_key_and_value()
45
46
// Act
46
47
47
48
// Assert
48
- $ this ->assertEquals ('key ' , $ item ->getKey ());
49
- $ this ->assertEquals ($ value , $ item ->get ());
49
+ $ this ->assertSame ('key ' , $ item ->getKey ());
50
+ $ this ->assertSame ($ value , $ item ->get ());
50
51
}
51
52
52
53
/** @test */
@@ -58,7 +59,10 @@ public function it_can_set_ttl_in_seconds()
58
59
// Act
59
60
60
61
// Assert
61
- $ this ->assertEquals (new \DateTimeImmutable ('+ 1 minute ' ), $ expiringInExactlyOneMinute ->getExpiresAt ());
62
+ $ this ->assertSame (
63
+ (new DateTimeImmutable ('+ 1 minute ' ))->format ('d-m-Y H:i:s ' ),
64
+ $ expiringInExactlyOneMinute ->getExpiresAt ()->format ('d-m-Y H:i:s ' )
65
+ );
62
66
}
63
67
64
68
/** @test */
@@ -70,7 +74,10 @@ public function it_can_set_ttl_with_date_interval()
70
74
// Act
71
75
72
76
// Assert
73
- $ this ->assertEquals (new \DateTimeImmutable ('+ 1 minute ' ), $ expiringInExactlyOneMinute ->getExpiresAt ());
77
+ $ this ->assertSame (
78
+ (new DateTimeImmutable ('+ 1 minute ' ))->format ('d-m-Y H:i:s ' ),
79
+ $ expiringInExactlyOneMinute ->getExpiresAt ()->format ('d-m-Y H:i:s ' )
80
+ );
74
81
}
75
82
76
83
/** @test */
@@ -84,7 +91,7 @@ public function it_can_set_expiry_with_datetime()
84
91
$ item ->expiresAt ($ now ->addMinute ());
85
92
86
93
// Assert
87
- $ this ->assertTrue ($ now == $ item ->getExpiresAt ());
94
+ $ this ->assertEquals ($ now, $ item ->getExpiresAt ());
88
95
}
89
96
90
97
/** @test */
@@ -109,7 +116,7 @@ public function it_will_remember_value_that_has_been_set()
109
116
$ item ->set ('bar ' );
110
117
111
118
// Assert
112
- $ this ->assertEquals ('bar ' , $ item ->get ());
119
+ $ this ->assertSame ('bar ' , $ item ->get ());
113
120
}
114
121
115
122
/** @test */
0 commit comments