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
|
* testControllerTypeError
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @throws PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testControllerTypeError() {
|
public function testControllerTypeError() {
|
||||||
try {
|
try {
|
||||||
$this->auth->controller(new StdClass());
|
$this->auth->controller(new StdClass());
|
||||||
|
$this->fail('No exception thrown');
|
||||||
} catch (Throwable $t) {
|
} 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
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testWriteWithFalseyValue() {
|
public function testWriteWithFalseyValue() {
|
||||||
|
$this->skipIf(!extension_loaded('mcrypt'), 'No Mcrypt, skipping.');
|
||||||
$this->Cookie->type('aes');
|
$this->Cookie->type('aes');
|
||||||
$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#HKis~#^';
|
$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.
|
* test reader() throwing exceptions on missing interface.
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @throws PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testReaderExceptionOnIncorrectClass() {
|
public function testReaderExceptionOnIncorrectClass() {
|
||||||
|
@ -458,8 +456,9 @@ class ConfigureTest extends CakeTestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Configure::config('test', $reader);
|
Configure::config('test', $reader);
|
||||||
|
$this->fail('No error raised');
|
||||||
} catch (Throwable $t) {
|
} catch (Throwable $t) {
|
||||||
throw new PHPUnit_Framework_Error($t);
|
$this->assertTrue(true, 'TypeError raised');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2908,15 +2908,14 @@ SQL;
|
||||||
/**
|
/**
|
||||||
* testDropSchemaNoSchema method
|
* testDropSchemaNoSchema method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @throws PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDropSchemaNoSchema() {
|
public function testDropSchemaNoSchema() {
|
||||||
try {
|
try {
|
||||||
$this->Dbo->dropSchema(null);
|
$this->Dbo->dropSchema(null);
|
||||||
|
$this->fail('No exception');
|
||||||
} catch (Throwable $t) {
|
} 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
|
* Test that type hint exception is thrown
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @throws PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testValidatorTypehintException() {
|
public function testValidatorTypehintException() {
|
||||||
try {
|
try {
|
||||||
new ModelValidator('asdasds');
|
new ModelValidator('asdasds');
|
||||||
|
$this->fail('No exeption raised');
|
||||||
} catch (Throwable $t) {
|
} 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
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEncryptDecrypt() {
|
public function testEncryptDecrypt() {
|
||||||
|
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||||
$txt = 'The quick brown fox';
|
$txt = 'The quick brown fox';
|
||||||
$key = 'This key is longer than 32 bytes long.';
|
$key = 'This key is longer than 32 bytes long.';
|
||||||
$result = Security::encrypt($txt, $key);
|
$result = Security::encrypt($txt, $key);
|
||||||
|
@ -342,6 +343,7 @@ class SecurityTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDecryptKeyFailure() {
|
public function testDecryptKeyFailure() {
|
||||||
|
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||||
$txt = 'The quick brown fox';
|
$txt = 'The quick brown fox';
|
||||||
$key = 'This key is longer than 32 bytes long.';
|
$key = 'This key is longer than 32 bytes long.';
|
||||||
Security::encrypt($txt, $key);
|
Security::encrypt($txt, $key);
|
||||||
|
@ -356,6 +358,7 @@ class SecurityTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDecryptHmacFailure() {
|
public function testDecryptHmacFailure() {
|
||||||
|
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||||
$txt = 'The quick brown fox';
|
$txt = 'The quick brown fox';
|
||||||
$key = 'This key is quite long and works well.';
|
$key = 'This key is quite long and works well.';
|
||||||
$salt = 'this is a delicious salt!';
|
$salt = 'this is a delicious salt!';
|
||||||
|
@ -372,6 +375,7 @@ class SecurityTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDecryptHmacSaltFailure() {
|
public function testDecryptHmacSaltFailure() {
|
||||||
|
$this->skipIf(!extension_loaded('mcrypt'), 'This test requires mcrypt to be installed');
|
||||||
$txt = 'The quick brown fox';
|
$txt = 'The quick brown fox';
|
||||||
$key = 'This key is quite long and works well.';
|
$key = 'This key is quite long and works well.';
|
||||||
$salt = 'this is a delicious salt!';
|
$salt = 'this is a delicious salt!';
|
||||||
|
@ -400,6 +404,7 @@ class SecurityTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEncryptDecryptFalseyData() {
|
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.';
|
$key = 'This is a key that is long enough to be ok.';
|
||||||
|
|
||||||
$result = Security::encrypt('', $key);
|
$result = Security::encrypt('', $key);
|
||||||
|
|
|
@ -564,7 +564,7 @@ class View extends CakeObject {
|
||||||
|
|
||||||
$type = $response->mapType($response->type());
|
$type = $response->mapType($response->type());
|
||||||
if (Configure::read('debug') > 0 && $type === 'html') {
|
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();
|
$out = ob_get_clean();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue