Ivan - Fix master login test
This commit is contained in:
parent
811f4dc272
commit
c613d886b3
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
class Session extends \Mock {
|
||||
public static $functionList = array();
|
||||
|
||||
public static function initStubs() {
|
||||
self::setStatics(array(
|
||||
'hashPassword' => parent::stub()->returns('HASHED_PASSword'),
|
||||
'verifyPassword' => parent::stub()->returns(true),
|
||||
'generateRandomToken' => parent::stub()->returns('TEST_TOKEN')
|
||||
));
|
||||
}
|
||||
|
||||
public static function mockInstanceFunction($functionName, $functionMock) {
|
||||
self::getInstance()->{$functionName} = $functionMock;
|
||||
}
|
||||
|
||||
private static function getInstanceMock() {
|
||||
return new \Mock(array(
|
||||
'initSession' => parent::stub(),
|
||||
'closeSession' => parent::stub(),
|
||||
'createSession' => parent::stub(),
|
||||
'getToken' => parent::stub()->returns('TEST_TOKEN'),
|
||||
'sessionExists' => parent::stub()->returns(false),
|
||||
'checkAuthentication' => parent::stub()->returns(true),
|
||||
'isLoggedWithId' => parent::stub()->returns(true),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -38,7 +38,8 @@ class LoginControllerTest extends PHPUnit_Framework_TestCase {
|
|||
$this->assertTrue(Response::get('respondSuccess')->hasBeenCalledWithArgs(array(
|
||||
'userId' => 'MOCK_ID',
|
||||
'userEmail' => 'MOCK_EMAIL',
|
||||
'token' => 'TEST_TOKEN'
|
||||
'token' => 'TEST_TOKEN',
|
||||
'rememberToken' => null
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue