mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix errors in php7.1
* The constructor of errors has changed in PHP 7.1 * mcrypt is no longer available in PHP 7.1 by default.
This commit is contained in:
parent
caaf748883
commit
e3221b1c38
7 changed files with 15 additions and 13 deletions
|
@ -47,15 +47,14 @@ class ControllerAuthorizeTest extends CakeTestCase {
|
|||
/**
|
||||
* testControllerTypeError
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testControllerTypeError() {
|
||||
try {
|
||||
$this->auth->controller(new StdClass());
|
||||
$this->fail('No exception thrown');
|
||||
} catch (Throwable $t) {
|
||||
throw new PHPUnit_Framework_Error($t);
|
||||
$this->assertTrue(true, 'Exception was raised');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -207,6 +207,7 @@ class CookieComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testWriteWithFalseyValue() {
|
||||
$this->skipIf(!extension_loaded('mcrypt'), 'No Mcrypt, skipping.');
|
||||
$this->Cookie->type('aes');
|
||||
$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#HKis~#^';
|
||||
|
||||
|
|
|
@ -449,8 +449,6 @@ class ConfigureTest extends CakeTestCase {
|
|||
/**
|
||||
* test reader() throwing exceptions on missing interface.
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testReaderExceptionOnIncorrectClass() {
|
||||
|
@ -458,8 +456,9 @@ class ConfigureTest extends CakeTestCase {
|
|||
|
||||
try {
|
||||
Configure::config('test', $reader);
|
||||
$this->fail('No error raised');
|
||||
} catch (Throwable $t) {
|
||||
throw new PHPUnit_Framework_Error($t);
|
||||
$this->assertTrue(true, 'TypeError raised');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2908,15 +2908,14 @@ SQL;
|
|||
/**
|
||||
* testDropSchemaNoSchema method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testDropSchemaNoSchema() {
|
||||
try {
|
||||
$this->Dbo->dropSchema(null);
|
||||
$this->fail('No exception');
|
||||
} catch (Throwable $t) {
|
||||
throw new PHPUnit_Framework_Error($t);
|
||||
$this->assertTrue(true, 'Exception raised');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2223,15 +2223,14 @@ class ModelValidationTest extends BaseModelTest {
|
|||
/**
|
||||
* Test that type hint exception is thrown
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testValidatorTypehintException() {
|
||||
try {
|
||||
new ModelValidator('asdasds');
|
||||
$this->fail('No exeption raised');
|
||||
} catch (Throwable $t) {
|
||||
throw new PHPUnit_Framework_Error($t);
|
||||
$this->assertTrue(true, 'An error/exception was raised');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -328,6 +328,7 @@ class SecurityTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testEncryptDecrypt() {
|
||||
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||
$txt = 'The quick brown fox';
|
||||
$key = 'This key is longer than 32 bytes long.';
|
||||
$result = Security::encrypt($txt, $key);
|
||||
|
@ -342,6 +343,7 @@ class SecurityTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testDecryptKeyFailure() {
|
||||
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||
$txt = 'The quick brown fox';
|
||||
$key = 'This key is longer than 32 bytes long.';
|
||||
Security::encrypt($txt, $key);
|
||||
|
@ -356,6 +358,7 @@ class SecurityTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testDecryptHmacFailure() {
|
||||
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||
$txt = 'The quick brown fox';
|
||||
$key = 'This key is quite long and works well.';
|
||||
$salt = 'this is a delicious salt!';
|
||||
|
@ -372,6 +375,7 @@ class SecurityTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testDecryptHmacSaltFailure() {
|
||||
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||
$txt = 'The quick brown fox';
|
||||
$key = 'This key is quite long and works well.';
|
||||
$salt = 'this is a delicious salt!';
|
||||
|
@ -400,6 +404,7 @@ class SecurityTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testEncryptDecryptFalseyData() {
|
||||
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||
$key = 'This is a key that is long enough to be ok.';
|
||||
|
||||
$result = Security::encrypt('', $key);
|
||||
|
|
|
@ -564,7 +564,7 @@ class View extends CakeObject {
|
|||
|
||||
$type = $response->mapType($response->type());
|
||||
if (Configure::read('debug') > 0 && $type === 'html') {
|
||||
echo "<!-- Cached Render Time: " . round(microtime(true) - $timeStart, 4) . "s -->";
|
||||
echo "<!-- Cached Render Time: " . round(microtime(true) - (int)$timeStart, 4) . "s -->";
|
||||
}
|
||||
$out = ob_get_clean();
|
||||
|
||||
|
|
Loading…
Reference in a new issue