minor #12086 [Security][Http][Authentication] Make a test pass on HHVM (AlphaStream)
This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes #12086).
Discussion
----------
[Security][Http][Authentication] Make a test pass on HHVM
The test mocks AuthenticationException mocking all its (and its ancestors') methods. In HHVM's implementation of \Exception, a static method is called upon instantiation. Mock object generator, however, mocks static methods with 'throw' statements. All of these cause the SimpleAuthenticationHandlerTest to fail on HHVM when attempting to instantiate the mock.
The solution is to disable method mocking for AuthenticationException. An instance of this class is merely passed around between the authentication handler and the failure handler, and no methods are invoked on it. Hence, disabling method mocking should not weaken the unit test.
| Q | A
| ------------- | ---
| Bug fix? | [no]
| New feature? | [no]
| BC breaks? | [no]
| Deprecations? | [no]
| Tests pass? | [yes]
| Fixed tickets | [none]
| License | MIT
| Doc PR | [none]
Commits
-------
7ff903e
[Security][Http][Authentication] Make a test pass on HHVM
This commit is contained in:
commit
408c6aa501
@ -37,7 +37,8 @@ class SimpleAuthenticationHandlerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
||||
$this->token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$this->authenticationException = $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
||||
// No methods are invoked on the exception; we just assert on its class
|
||||
$this->authenticationException = new \Symfony\Component\Security\Core\Exception\AuthenticationException();
|
||||
|
||||
$this->response = $this->getMock('Symfony\Component\HttpFoundation\Response');
|
||||
}
|
||||
|
Reference in New Issue
Block a user