Skip to content

Commit

Permalink
Whitespace cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Aug 21, 2013
1 parent f2b6a3d commit 6b9dd0e
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions test/classes/plugin/auth/PMA_AuthenticationCookie_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function setup()

/**
* tearDown for test cases
*
*
* @return void
*/
public function tearDown()
Expand All @@ -50,7 +50,7 @@ public function tearDown()

/**
* Test for AuthenticationConfig::auth
*
*
* @return void
*/
public function testAuth()
Expand Down Expand Up @@ -83,15 +83,15 @@ public function testAuth()
);

$attrInstance = new ReflectionProperty('PMA_Response', '_instance');
$attrInstance->setAccessible(true);
$attrInstance->setAccessible(true);
$attrInstance->setValue(null, $mockResponse);
$GLOBALS['conn_error'] = true;
$GLOBALS['cfg']['PmaAbsoluteUri'] = 'https://phpmyadmin.net/';
$this->assertTrue(
$this->object->auth()
);
// Case 2

$mockResponse = $this->getMockBuilder('PMA_Response')
->disableOriginalConstructor()
->setMethods(array('isAjax', 'isSuccess', 'addJSON'))
Expand All @@ -118,7 +118,7 @@ public function testAuth()
);

$attrInstance = new ReflectionProperty('PMA_Response', '_instance');
$attrInstance->setAccessible(true);
$attrInstance->setAccessible(true);
$attrInstance->setValue(null, $mockResponse);
$GLOBALS['conn_error'] = '';

Expand All @@ -127,7 +127,7 @@ public function testAuth()
);

// case 3

$mockResponse = $this->getMockBuilder('PMA_Response')
->disableOriginalConstructor()
->setMethods(array('isAjax', 'getFooter', 'getHeader'))
Expand All @@ -138,7 +138,7 @@ public function testAuth()
->with()
->will($this->returnValue(false));



$_REQUEST['old_usr'] = '';
$GLOBALS['cfg']['LoginCookieRecall'] = true;
Expand Down Expand Up @@ -168,7 +168,7 @@ public function testAuth()
$mockHeader->expects($this->once())
->method('setBodyId')
->with('loginform');

$mockHeader->expects($this->once())
->method('setTitle')
->with('phpMyAdmin');
Expand All @@ -194,7 +194,7 @@ public function testAuth()
->will($this->returnValue($mockHeader));

$attrInstance = new ReflectionProperty('PMA_Response', '_instance');
$attrInstance->setAccessible(true);
$attrInstance->setAccessible(true);
$attrInstance->setValue(null, $mockResponse);

$GLOBALS['pmaThemeImage'] = 'test';
Expand All @@ -210,7 +210,7 @@ public function testAuth()
file_put_contents('testlogo_right.png', '');

// mock error handler

$mockErrorHandler = $this->getMockBuilder('PMA_Error_Handler')
->disableOriginalConstructor()
->setMethods(array('hasDisplayErrors', 'dispErrors'))
Expand All @@ -220,7 +220,7 @@ public function testAuth()
->method('hasDisplayErrors')
->with()
->will($this->returnValue(true));

$mockErrorHandler->expects($this->once())
->method('dispErrors')
->with();
Expand All @@ -232,14 +232,14 @@ public function testAuth()
$result = ob_get_clean();

// assertions

$this->assertTag(
PMA_getTagArray(
'<img src="testlogo_right.png" id="imLogo"'
),
$result
);

$this->assertTag(
PMA_getTagArray(
'<div class="error">'
Expand Down Expand Up @@ -282,7 +282,7 @@ public function testAuth()
$this->assertTag(
PMA_getTagArray(
'<select name="server" id="select_server" ' .
'onchange="document.forms[\'login_form\'].' .
'onchange="document.forms[\'login_form\'].' .
'elements[\'pma_servername\'].value = \'\'" >'
),
$result
Expand Down Expand Up @@ -312,7 +312,7 @@ public function testAuth()
@unlink('testlogo_right.png');

// case 4

$mockResponse = $this->getMockBuilder('PMA_Response')
->disableOriginalConstructor()
->setMethods(array('isAjax', 'getFooter', 'getHeader'))
Expand All @@ -337,7 +337,7 @@ public function testAuth()
$GLOBALS['cfg']['LoginCookieRecall'] = false;

$attrInstance = new ReflectionProperty('PMA_Response', '_instance');
$attrInstance->setAccessible(true);
$attrInstance->setAccessible(true);
$attrInstance->setValue(null, $mockResponse);

$GLOBALS['pmaThemeImage'] = 'test';
Expand All @@ -356,14 +356,14 @@ public function testAuth()
$result = ob_get_clean();

// assertions

$this->assertTag(
PMA_getTagArray(
'<img name="imLogo" id="imLogo" src="testpma_logo.png"'
),
$result
);

$this->assertTag(
PMA_getTagArray(
'<select name="lang" class="autosubmit" lang="en" dir="ltr" ' .
Expand Down Expand Up @@ -393,7 +393,7 @@ public function testAuth()
);

$this->assertContains(
'iframe src="https://www.google.com/recaptcha/api/noscript' .
'iframe src="https://www.google.com/recaptcha/api/noscript' .
'?k=testpubkey"',
$result
);
Expand Down Expand Up @@ -428,7 +428,7 @@ public function testAuth()

/**
* Test for AuthenticationConfig::auth with headers
*
*
* @return void
*/
public function testAuthHeader()
Expand All @@ -452,7 +452,7 @@ public function testAuthHeader()
->will($this->returnValue(false));

$attrInstance = new ReflectionProperty('PMA_Response', '_instance');
$attrInstance->setAccessible(true);
$attrInstance->setAccessible(true);
$attrInstance->setValue(null, $mockResponse);

$_REQUEST['old_usr'] = 'user1';
Expand All @@ -472,7 +472,7 @@ public function testAuthHeader()

/**
* Test for AuthenticationConfig::authCheck
*
*
* @return void
*/
public function testAuthCheck()
Expand All @@ -491,7 +491,7 @@ public function testAuthCheck()
}

$GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey';

file_put_contents('testConfigSwekey', '');
$this->assertFalse(
$this->object->authCheck()
Expand All @@ -505,7 +505,7 @@ public function testAuthCheck()
$GLOBALS['cfg']['CaptchaLoginPublicKey'] = 'testpubkey';
$_POST["recaptcha_challenge_field"] = 'captcha1';
$_POST["recaptcha_response_field"] = '';

$this->assertFalse(
$this->object->authCheck()
);
Expand All @@ -522,7 +522,7 @@ public function testAuthCheck()
$GLOBALS['cfg']['CaptchaLoginPublicKey'] = 'testpubkey';
$_POST["recaptcha_challenge_field"] = '';
$_POST["recaptcha_response_field"] = '';

$this->assertFalse(
$this->object->authCheck()
);
Expand Down Expand Up @@ -577,7 +577,7 @@ public function testAuthCheck()
'testPMAUser',
$GLOBALS['PHP_AUTH_USER']
);

$this->assertEquals(
'testPMAPSWD',
$GLOBALS['PHP_AUTH_PW']
Expand All @@ -598,7 +598,7 @@ public function testAuthCheck()
$GLOBALS['server'] = 1;
$_COOKIE['pmaServer-1'] = 'pmaServ1';
$_COOKIE['pmaUser-1'] = '';

$this->assertFalse(
$this->object->authCheck()
);
Expand Down Expand Up @@ -630,7 +630,7 @@ public function testAuthCheck()

/**
* Test for AuthenticationConfig::authCheck with constant modifications
*
*
* @return void
*/
public function testAuthCheckWithConstants()
Expand All @@ -640,14 +640,14 @@ public function testAuthCheckWithConstants()
'Cannot redefine constant/function - missing runkit extension'
);
}

$remove = false;

if (! defined('PMA_CLEAR_COOKIES')) {
define('PMA_CLEAR_COOKIES', true);
$remove = true;
}

$GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey';
$GLOBALS['cfg']['Servers'] = array(1);
$_COOKIE['pmaPass-0'] = 1;
Expand Down Expand Up @@ -677,11 +677,11 @@ public function testAuthCheckWithConstants()

/**
* Test for AuthenticationConfig::authCheck (mock blowfish functions reqd)
*
*
* @return void
*/
public function testAuthCheckBlowfishCase()
{
{
$GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey';
$GLOBALS['server'] = 1;
$_REQUEST['old_usr'] = '';
Expand Down Expand Up @@ -714,11 +714,11 @@ public function testAuthCheckBlowfishCase()

/**
* Test for AuthenticationConfig::authCheck (mocking blowfish functions)
*
*
* @return void
*/
public function testAuthCheckBlowfishCaseSecond()
{
{
$GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey';
$GLOBALS['server'] = 1;
$_REQUEST['old_usr'] = '';
Expand All @@ -730,7 +730,7 @@ public function testAuthCheckBlowfishCaseSecond()
$_SESSION['last_valid_captcha'] = true;
$_SESSION['last_access_time'] = time() - 1000;
$GLOBALS['cfg']['LoginCookieValidity'] = 1440;

// mock for blowfish function
$this->object = $this->getMockBuilder('AuthenticationCookie')
->disableOriginalConstructor()
Expand Down Expand Up @@ -758,11 +758,11 @@ public function testAuthCheckBlowfishCaseSecond()

/**
* Test for AuthenticationConfig::authCheck (mocking the object itself)
*
*
* @return void
*/
public function testAuthCheckAuthFails()
{
{
$GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey';
$GLOBALS['server'] = 1;
$_REQUEST['old_usr'] = '';
Expand Down Expand Up @@ -794,7 +794,7 @@ public function testAuthCheckAuthFails()

/**
* Test for AuthenticationConfig::authSetUser
*
*
* @return void
*/
public function testAuthSetUser()
Expand Down Expand Up @@ -849,7 +849,7 @@ public function testAuthSetUser()

/**
* Test for AuthenticationConfig::authSetUser (check for headers redirect)
*
*
* @return void
*/
public function testAuthSetUserWithHeaders()
Expand Down Expand Up @@ -894,11 +894,11 @@ public function testAuthSetUserWithHeaders()
->method('disable');

$attrInstance = new ReflectionProperty('PMA_Response', '_instance');
$attrInstance->setAccessible(true);
$attrInstance->setAccessible(true);
$attrInstance->setValue(null, $mockResponse);

$this->object->authSetUser();

$this->assertTrue(
isset($_COOKIE['pmaServer-2'])
);
Expand All @@ -914,7 +914,7 @@ public function testAuthSetUserWithHeaders()

/**
* Test for AuthenticationConfig::authFails
*
*
* @return void
*/
public function testAuthFails()
Expand Down Expand Up @@ -1018,7 +1018,7 @@ public function testAuthFails()

/**
* Test for AuthenticationConfig::_getBlowfishSecret
*
*
* @return void
*/
public function testGetBlowfishSecret()
Expand Down Expand Up @@ -1047,7 +1047,7 @@ public function testGetBlowfishSecret()
);

// case 2

$GLOBALS['cfg']['blowfish_secret'] = 'notEmpty';

$result = $method->invoke($this->object, null);
Expand All @@ -1060,11 +1060,11 @@ public function testGetBlowfishSecret()

/**
* Test for AuthenticationConfig::blowfishEncrypt
*
*
* @return void
*/
public function testBlowfishEncrypt()
{
{
if (! function_exists('mcrypt_encrypt')) {
$this->assertEquals(
'/xytF/kXKuBx7zHzGexkFw==',
Expand All @@ -1088,7 +1088,7 @@ public function testBlowfishEncrypt()

/**
* Test for AuthenticationConfig::blowfishDecrypt
*
*
* @return void
*/
public function testBlowfishDecrypt()
Expand Down

0 comments on commit 6b9dd0e

Please sign in to comment.