@@ -19,7 +19,7 @@ class StrictSessionHandlerTest extends TestCase
19
19
{
20
20
public function testOpen ()
21
21
{
22
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
22
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
23
23
$ handler ->expects ($ this ->once ())->method ('open ' )
24
24
->with ('path ' , 'name ' )->willReturn (true );
25
25
$ proxy = new StrictSessionHandler ($ handler );
@@ -31,7 +31,7 @@ public function testOpen()
31
31
32
32
public function testCloseSession ()
33
33
{
34
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
34
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
35
35
$ handler ->expects ($ this ->once ())->method ('close ' )
36
36
->willReturn (true );
37
37
$ proxy = new StrictSessionHandler ($ handler );
@@ -41,7 +41,7 @@ public function testCloseSession()
41
41
42
42
public function testValidateIdOK ()
43
43
{
44
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
44
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
45
45
$ handler ->expects ($ this ->once ())->method ('read ' )
46
46
->with ('id ' )->willReturn ('data ' );
47
47
$ proxy = new StrictSessionHandler ($ handler );
@@ -51,7 +51,7 @@ public function testValidateIdOK()
51
51
52
52
public function testValidateIdKO ()
53
53
{
54
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
54
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
55
55
$ handler ->expects ($ this ->once ())->method ('read ' )
56
56
->with ('id ' )->willReturn ('' );
57
57
$ proxy = new StrictSessionHandler ($ handler );
@@ -61,7 +61,7 @@ public function testValidateIdKO()
61
61
62
62
public function testRead ()
63
63
{
64
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
64
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
65
65
$ handler ->expects ($ this ->once ())->method ('read ' )
66
66
->with ('id ' )->willReturn ('data ' );
67
67
$ proxy = new StrictSessionHandler ($ handler );
@@ -71,7 +71,7 @@ public function testRead()
71
71
72
72
public function testReadWithValidateIdOK ()
73
73
{
74
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
74
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
75
75
$ handler ->expects ($ this ->once ())->method ('read ' )
76
76
->with ('id ' )->willReturn ('data ' );
77
77
$ proxy = new StrictSessionHandler ($ handler );
@@ -82,7 +82,7 @@ public function testReadWithValidateIdOK()
82
82
83
83
public function testReadWithValidateIdMismatch ()
84
84
{
85
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
85
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
86
86
$ handler ->expects ($ this ->exactly (2 ))->method ('read ' )
87
87
->withConsecutive (['id1 ' ], ['id2 ' ])
88
88
->will ($ this ->onConsecutiveCalls ('data1 ' , 'data2 ' ));
@@ -94,7 +94,7 @@ public function testReadWithValidateIdMismatch()
94
94
95
95
public function testUpdateTimestamp ()
96
96
{
97
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
97
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
98
98
$ handler ->expects ($ this ->once ())->method ('write ' )
99
99
->with ('id ' , 'data ' )->willReturn (true );
100
100
$ proxy = new StrictSessionHandler ($ handler );
@@ -104,7 +104,7 @@ public function testUpdateTimestamp()
104
104
105
105
public function testWrite ()
106
106
{
107
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
107
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
108
108
$ handler ->expects ($ this ->once ())->method ('write ' )
109
109
->with ('id ' , 'data ' )->willReturn (true );
110
110
$ proxy = new StrictSessionHandler ($ handler );
@@ -114,7 +114,7 @@ public function testWrite()
114
114
115
115
public function testWriteEmptyNewSession ()
116
116
{
117
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
117
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
118
118
$ handler ->expects ($ this ->once ())->method ('read ' )
119
119
->with ('id ' )->willReturn ('' );
120
120
$ handler ->expects ($ this ->never ())->method ('write ' );
@@ -128,7 +128,7 @@ public function testWriteEmptyNewSession()
128
128
129
129
public function testWriteEmptyExistingSession ()
130
130
{
131
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
131
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
132
132
$ handler ->expects ($ this ->once ())->method ('read ' )
133
133
->with ('id ' )->willReturn ('data ' );
134
134
$ handler ->expects ($ this ->never ())->method ('write ' );
@@ -141,7 +141,7 @@ public function testWriteEmptyExistingSession()
141
141
142
142
public function testDestroy ()
143
143
{
144
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
144
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
145
145
$ handler ->expects ($ this ->once ())->method ('destroy ' )
146
146
->with ('id ' )->willReturn (true );
147
147
$ proxy = new StrictSessionHandler ($ handler );
@@ -151,7 +151,7 @@ public function testDestroy()
151
151
152
152
public function testDestroyNewSession ()
153
153
{
154
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
154
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
155
155
$ handler ->expects ($ this ->once ())->method ('read ' )
156
156
->with ('id ' )->willReturn ('' );
157
157
$ handler ->expects ($ this ->once ())->method ('destroy ' )->willReturn (true );
@@ -163,7 +163,7 @@ public function testDestroyNewSession()
163
163
164
164
public function testDestroyNonEmptyNewSession ()
165
165
{
166
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
166
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
167
167
$ handler ->expects ($ this ->once ())->method ('read ' )
168
168
->with ('id ' )->willReturn ('' );
169
169
$ handler ->expects ($ this ->once ())->method ('write ' )
@@ -179,7 +179,7 @@ public function testDestroyNonEmptyNewSession()
179
179
180
180
public function testGc ()
181
181
{
182
- $ handler = $ this ->getMockBuilder (\SessionHandlerInterface::class)-> getMock ( );
182
+ $ handler = $ this ->createMock (\SessionHandlerInterface::class);
183
183
$ handler ->expects ($ this ->once ())->method ('gc ' )
184
184
->with (123 )->willReturn (true );
185
185
$ proxy = new StrictSessionHandler ($ handler );
0 commit comments