Always restore mocked instance after test
Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
baa922e902
commit
a6764bab9b
@ -217,6 +217,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('addHtml'))
|
||||
->getMock();
|
||||
|
||||
$restoreInstance = PMA_Response::getInstance();
|
||||
$response = new ReflectionProperty('PMA_Response', '_instance');
|
||||
$response->setAccessible(true);
|
||||
$response->setValue($responseMock);
|
||||
@ -225,6 +226,8 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
|
||||
array(false), 0, array('1'), 'SELECT', array('1' => 'result1')
|
||||
);
|
||||
|
||||
$attrInstance->setValue($restoreInstance);
|
||||
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
@ -1926,12 +1929,15 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
|
||||
->method('getHeader')
|
||||
->will($this->returnValue($headerMock));
|
||||
|
||||
$restoreInstance = PMA_Response::getInstance();
|
||||
$response = new ReflectionProperty('PMA_Response', '_instance');
|
||||
$response->setAccessible(true);
|
||||
$response->setValue($responseMock);
|
||||
|
||||
PMA_isInsertRow();
|
||||
|
||||
$attrInstance->setValue($restoreInstance);
|
||||
|
||||
$this->assertEquals(5, $GLOBALS['cfg']['InsertRows']);
|
||||
}
|
||||
|
||||
@ -2765,6 +2771,7 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('addHtml'))
|
||||
->getMock();
|
||||
|
||||
$restoreInstance = PMA_Response::getInstance();
|
||||
$response = new ReflectionProperty('PMA_Response', '_instance');
|
||||
$response->setAccessible(true);
|
||||
$response->setValue($responseMock);
|
||||
@ -2792,6 +2799,8 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$result = PMA_determineInsertOrEdit(null, 'db', 'table');
|
||||
|
||||
$attrInstance->setValue($restoreInstance);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user