Skip to content

Commit 9840cd2

Browse files
OskarStarkchalasr
authored andcommitted
Use createMock() instead of a getter
1 parent c275805 commit 9840cd2

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Tests/Session/SessionAuthenticationStrategyTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testSessionIsNotChanged()
2525
$request->expects($this->never())->method('getSession');
2626

2727
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::NONE);
28-
$strategy->onAuthentication($request, $this->getToken());
28+
$strategy->onAuthentication($request, $this->createMock(TokenInterface::class));
2929
}
3030

3131
public function testUnsupportedStrategy()
@@ -36,7 +36,7 @@ public function testUnsupportedStrategy()
3636
$request->expects($this->never())->method('getSession');
3737

3838
$strategy = new SessionAuthenticationStrategy('foo');
39-
$strategy->onAuthentication($request, $this->getToken());
39+
$strategy->onAuthentication($request, $this->createMock(TokenInterface::class));
4040
}
4141

4242
public function testSessionIsMigrated()
@@ -45,7 +45,7 @@ public function testSessionIsMigrated()
4545
$session->expects($this->once())->method('migrate')->with($this->equalTo(true));
4646

4747
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE);
48-
$strategy->onAuthentication($this->getRequest($session), $this->getToken());
48+
$strategy->onAuthentication($this->getRequest($session), $this->createMock(TokenInterface::class));
4949
}
5050

5151
public function testSessionIsInvalidated()
@@ -54,7 +54,7 @@ public function testSessionIsInvalidated()
5454
$session->expects($this->once())->method('invalidate');
5555

5656
$strategy = new SessionAuthenticationStrategy(SessionAuthenticationStrategy::INVALIDATE);
57-
$strategy->onAuthentication($this->getRequest($session), $this->getToken());
57+
$strategy->onAuthentication($this->getRequest($session), $this->createMock(TokenInterface::class));
5858
}
5959

6060
private function getRequest($session = null)
@@ -67,9 +67,4 @@ private function getRequest($session = null)
6767

6868
return $request;
6969
}
70-
71-
private function getToken()
72-
{
73-
return $this->createMock(TokenInterface::class);
74-
}
7570
}

0 commit comments

Comments
 (0)