Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6c9155

Browse files
committed
minor #42384 [HttpFoundation] Fix broken mock (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpFoundation] Fix broken mock | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Backport from #42378. This PR fixes a couple of mocked methods that currently return `null` although a real implementation would never do that. Commits ------- af37c64 Fix broken mock
2 parents 6d0e144 + af37c64 commit e6c9155

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,21 @@ public function testRead()
103103
public function testWrite()
104104
{
105105
$this->mock->expects($this->once())
106-
->method('write');
106+
->method('write')
107+
->willReturn(true)
108+
;
107109

108-
$this->proxy->write('id', 'data');
110+
$this->assertTrue($this->proxy->write('id', 'data'));
109111
}
110112

111113
public function testDestroy()
112114
{
113115
$this->mock->expects($this->once())
114-
->method('destroy');
116+
->method('destroy')
117+
->willReturn(true)
118+
;
115119

116-
$this->proxy->destroy('id');
120+
$this->assertTrue($this->proxy->destroy('id'));
117121
}
118122

119123
public function testGc()
@@ -149,7 +153,9 @@ public function testUpdateTimestamp()
149153
$proxy->updateTimestamp('id', 'data');
150154

151155
$this->mock->expects($this->once())
152-
->method('write');
156+
->method('write')
157+
->willReturn(true)
158+
;
153159

154160
$this->proxy->updateTimestamp('id', 'data');
155161
}

0 commit comments

Comments
 (0)