mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
test: Replace deprecated @expectedException PHPUnit_Framework_Error
This commit is contained in:
parent
c04692f76c
commit
fe34a8551c
7 changed files with 25 additions and 25 deletions
|
@ -47,16 +47,16 @@ class ControllerAuthorizeTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testControllerTypeError
|
* testControllerTypeError
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
* @throws PHPUnit_Framework_Error
|
* @throws \PHPUnit\Framework\Error
|
||||||
*/
|
*/
|
||||||
public function testControllerTypeError() {
|
public function testControllerTypeError() {
|
||||||
|
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||||
try {
|
try {
|
||||||
$this->auth->controller(new StdClass());
|
$this->auth->controller(new StdClass());
|
||||||
$this->fail('No exception thrown');
|
$this->fail('No exception thrown');
|
||||||
} catch (TypeError $e) {
|
} catch (TypeError $e) {
|
||||||
throw new PHPUnit_Framework_Error('Raised an error', 100, __FILE__, __LINE__);
|
throw new \PHPUnit\Framework\Error('Raised an error', 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,17 +456,17 @@ class ConfigureTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* test reader() throwing exceptions on missing interface.
|
* test reader() throwing exceptions on missing interface.
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
* @throws PHPUnit_Framework_Error
|
* @throws \PHPUnit\Framework\Error
|
||||||
*/
|
*/
|
||||||
public function testReaderExceptionOnIncorrectClass() {
|
public function testReaderExceptionOnIncorrectClass() {
|
||||||
|
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||||
$reader = new StdClass();
|
$reader = new StdClass();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Configure::config('test', $reader);
|
Configure::config('test', $reader);
|
||||||
} catch (TypeError $e) {
|
} catch (TypeError $e) {
|
||||||
throw new PHPUnit_Framework_Error('Raised an error', 100, __FILE__, __LINE__);
|
throw new \PHPUnit\Framework\Error('Raised an error', 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,10 +150,10 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testInvalidContainments method
|
* testInvalidContainments method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testInvalidContainments() {
|
public function testInvalidContainments() {
|
||||||
|
$this->expectWarning();
|
||||||
$this->_containments($this->Article, array('Comment', 'InvalidBinding'));
|
$this->_containments($this->Article, array('Comment', 'InvalidBinding'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +241,10 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testBeforeFindWithNonExistingBinding method
|
* testBeforeFindWithNonExistingBinding method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBeforeFindWithNonExistingBinding() {
|
public function testBeforeFindWithNonExistingBinding() {
|
||||||
|
$this->expectWarning();
|
||||||
$this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding')));
|
$this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2883,16 +2883,16 @@ SQL;
|
||||||
/**
|
/**
|
||||||
* testDropSchemaNoSchema method
|
* testDropSchemaNoSchema method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
* @throws PHPUnit_Framework_Error
|
* @throws \PHPUnit\Framework\Error
|
||||||
*/
|
*/
|
||||||
public function testDropSchemaNoSchema() {
|
public function testDropSchemaNoSchema() {
|
||||||
|
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||||
try {
|
try {
|
||||||
$this->Dbo->dropSchema(null);
|
$this->Dbo->dropSchema(null);
|
||||||
$this->fail('No exception');
|
$this->fail('No exception');
|
||||||
} catch (TypeError $e) {
|
} catch (TypeError $e) {
|
||||||
throw new PHPUnit_Framework_Error('Raised an error', 100, __FILE__, __LINE__);
|
throw new \PHPUnit\Framework\Error('Raised an error', 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3232,10 +3232,10 @@ SQL;
|
||||||
/**
|
/**
|
||||||
* testBuildColumnBadType method
|
* testBuildColumnBadType method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBuildColumnBadType() {
|
public function testBuildColumnBadType() {
|
||||||
|
$this->expectWarning();
|
||||||
$data = array(
|
$data = array(
|
||||||
'name' => 'testName',
|
'name' => 'testName',
|
||||||
'type' => 'varchar(255)',
|
'type' => 'varchar(255)',
|
||||||
|
|
|
@ -772,10 +772,10 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
* Test that missing validation methods trigger errors in development mode.
|
* Test that missing validation methods trigger errors in development mode.
|
||||||
* Helps to make development easier.
|
* Helps to make development easier.
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testMissingValidationErrorTriggering() {
|
public function testMissingValidationErrorTriggering() {
|
||||||
|
$this->expectWarning();
|
||||||
Configure::write('debug', 2);
|
Configure::write('debug', 2);
|
||||||
|
|
||||||
$TestModel = new ValidationTest1();
|
$TestModel = new ValidationTest1();
|
||||||
|
@ -2226,16 +2226,16 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
/**
|
/**
|
||||||
* Test that type hint exception is thrown
|
* Test that type hint exception is thrown
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
* @throws PHPUnit_Framework_Error
|
* @throws \PHPUnit\Framework\Error
|
||||||
*/
|
*/
|
||||||
public function testValidatorTypehintException() {
|
public function testValidatorTypehintException() {
|
||||||
|
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||||
try {
|
try {
|
||||||
new ModelValidator('asdasds');
|
new ModelValidator('asdasds');
|
||||||
$this->fail('No exeption raised');
|
$this->fail('No exeption raised');
|
||||||
} catch (TypeError $e) {
|
} catch (TypeError $e) {
|
||||||
throw new PHPUnit_Framework_Error('Raised an error', 100, __FILE__, __LINE__);
|
throw new \PHPUnit\Framework\Error('Raised an error', 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,40 +87,40 @@ class SecurityTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testHashInvalidSalt method
|
* testHashInvalidSalt method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testHashInvalidSalt() {
|
public function testHashInvalidSalt() {
|
||||||
|
$this->expectWarning();
|
||||||
Security::hash('someKey', 'blowfish', true);
|
Security::hash('someKey', 'blowfish', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHashAnotherInvalidSalt
|
* testHashAnotherInvalidSalt
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testHashAnotherInvalidSalt() {
|
public function testHashAnotherInvalidSalt() {
|
||||||
|
$this->expectWarning();
|
||||||
Security::hash('someKey', 'blowfish', '$1$lksdjoijfaoijs');
|
Security::hash('someKey', 'blowfish', '$1$lksdjoijfaoijs');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHashYetAnotherInvalidSalt
|
* testHashYetAnotherInvalidSalt
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testHashYetAnotherInvalidSalt() {
|
public function testHashYetAnotherInvalidSalt() {
|
||||||
|
$this->expectWarning();
|
||||||
Security::hash('someKey', 'blowfish', '$2a$10$123');
|
Security::hash('someKey', 'blowfish', '$2a$10$123');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHashInvalidCost method
|
* testHashInvalidCost method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testHashInvalidCost() {
|
public function testHashInvalidCost() {
|
||||||
|
$this->expectWarning();
|
||||||
Security::setCost(1000);
|
Security::setCost(1000);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -269,10 +269,10 @@ class SecurityTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testCipherEmptyKey method
|
* testCipherEmptyKey method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCipherEmptyKey() {
|
public function testCipherEmptyKey() {
|
||||||
|
$this->expectWarning();
|
||||||
$txt = 'some_text';
|
$txt = 'some_text';
|
||||||
$key = '';
|
$key = '';
|
||||||
Security::cipher($txt, $key);
|
Security::cipher($txt, $key);
|
||||||
|
@ -321,10 +321,10 @@ class SecurityTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testRijndaelInvalidOperation method
|
* testRijndaelInvalidOperation method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testRijndaelInvalidOperation() {
|
public function testRijndaelInvalidOperation() {
|
||||||
|
$this->expectWarning();
|
||||||
$txt = 'The quick brown fox jumped over the lazy dog.';
|
$txt = 'The quick brown fox jumped over the lazy dog.';
|
||||||
$key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi';
|
$key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi';
|
||||||
Security::rijndael($txt, $key, 'foo');
|
Security::rijndael($txt, $key, 'foo');
|
||||||
|
@ -333,10 +333,10 @@ class SecurityTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testRijndaelInvalidKey method
|
* testRijndaelInvalidKey method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testRijndaelInvalidKey() {
|
public function testRijndaelInvalidKey() {
|
||||||
|
$this->expectWarning();
|
||||||
$txt = 'The quick brown fox jumped over the lazy dog.';
|
$txt = 'The quick brown fox jumped over the lazy dog.';
|
||||||
$key = 'too small';
|
$key = 'too small';
|
||||||
Security::rijndael($txt, $key, 'encrypt');
|
Security::rijndael($txt, $key, 'encrypt');
|
||||||
|
|
|
@ -2294,20 +2294,20 @@ class ValidationTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* test pass through failure on postal
|
* test pass through failure on postal
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testPassThroughMethodFailure() {
|
public function testPassThroughMethodFailure() {
|
||||||
|
$this->expectWarning();
|
||||||
Validation::phone('text', null, 'testNl');
|
Validation::phone('text', null, 'testNl');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the pass through calling of an alternate locale with postal()
|
* test the pass through calling of an alternate locale with postal()
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testPassThroughClassFailure() {
|
public function testPassThroughClassFailure() {
|
||||||
|
$this->expectWarning();
|
||||||
Validation::postal('text', null, 'AUTOFAIL');
|
Validation::postal('text', null, 'AUTOFAIL');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue