Ivan - Fix master login test

This commit is contained in:
ivan 2016-07-19 10:51:43 -03:00
parent 811f4dc272
commit c613d886b3
2 changed files with 31 additions and 1 deletions

View File

@ -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),
));
}
}

View File

@ -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
)));
}