8000 Code review changes · symfony/symfony@70cea86 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70cea86

Browse files
committed
Code review changes
1 parent 20af2bd commit 70cea86

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MigratingSessionHandler.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ class MigratingSessionHandler implements \SessionHandlerInterface
2525
private $currentHandler;
2626
private $writeOnlyHandler;
2727

28-
/**
29-
* @param \SessionHandlerInterface $currentHandler
30-
* @param \SessionHandlerInterface $writeOnlyHandler
31-
*/
3228
public function __construct(\SessionHandlerInterface $currentHandler, \SessionHandlerInterface $writeOnlyHandler)
3329
{
3430
$this->currentHandler = $currentHandler;
@@ -49,10 +45,10 @@ public function close()
4945
/**
5046
* {@inheritdoc}
5147
*/
52-
public function destroy($session_id)
48+
public function destroy($sessionId)
5349
{
54-
$result = $this->currentHandler->destroy($session_id);
55-
$this->writeOnlyHandler->destroy($session_id);
50+
$result = $this->currentHandler->destroy($sessionId);
51+
$this->writeOnlyHandler->destroy($sessionId);
5652

5753
return $result;
5854
}
@@ -71,32 +67,30 @@ public function gc($maxlifetime)
7167
/**
7268
* {@inheritdoc}
7369
*/
74-
public function open($save_path, $session_id)
70+
public function open($savePath, $sessionId)
7571
{
76-
$result = $this->currentHandler->open($save_path, $session_id);
77-
$this->writeOnlyHandler->open($save_path, $session_id);
72+
$result = $this->currentHandler->open($savePath, $sessionId);
73+
$this->writeOnlyHandler->open($savePath, $sessionId);
7874

7975
return $result;
8076
}
8177

8278
/**
8379
* {@inheritdoc}
8480
*/
85-
public function read($session_id)
81+
public function read($sessionId)
8682
{
8783
// No reading from new handler until switch-over
88-
$result = $this->currentHandler->read($session_id);
89-
90-
return $result;
84+
return $this->currentHandler->read($sessionId);
9185
}
9286

9387
/**
9488
* {@inheritdoc}
9589
*/
96-
public function write($session_id, $session_data)
90+
public function write($sessionId, $sessionData)
9791
{
98-
$result = $this->currentHandler->write($session_id, $session_data);
99-
$this->writeOnlyHandler->write($session_id, $session_data);
92+
$result = $this->currentHandler->write($sessionId, $sessionData);
93+
$this->writeOnlyHandler->write($sessionId, $sessionData);
10094

10195
return $result;
10296
}

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,10 @@ class MigratingSessionHandlerTest extends TestCase
2020
private $currentHandler;
2121
private $writeOnlyHandler;
2222

23-
public function setUp()
23+
protected function setUp()
2424
{
25-
$this->currentHandler = $this->getMockBuilder(\SessionHandlerInterface::class)
26-
->disableOriginalConstructor()
27-
->getMock();
28-
29-
$this->writeOnlyHandler = $this->getMockBuilder(\SessionHandlerInterface::class)
30-
->disableOriginalConstructor()
31-
->getMock();
25+
$this->currentHandler = $this->createMock(\SessionHandlerInterface::class);
26+
$this->writeOnlyHandler = $this->createMock(\SessionHandlerInterface::class);
3227

3328
$this->dualHandler = new MigratingSessionHandler($this->currentHandler, $this->writeOnlyHandler);
3429
}
@@ -127,7 +122,7 @@ public function testReads()
127122
public function testWrites()
128123
{
129124
$sessionId = 'xyz';
130-
$data = array('zfa' => 'hwq');
125+
$data = 'my-serialized-data';
131126

132127
$this->currentHandler->expects($this->once())
133128
->method('write')

0 commit comments

Comments
 (0)
0