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
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @throws \PHPUnit\Framework\Error
|
||||
*/
|
||||
public function testControllerTypeError() {
|
||||
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||
try {
|
||||
$this->auth->controller(new StdClass());
|
||||
$this->fail('No exception thrown');
|
||||
} 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.
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @throws \PHPUnit\Framework\Error
|
||||
*/
|
||||
public function testReaderExceptionOnIncorrectClass() {
|
||||
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||
$reader = new StdClass();
|
||||
|
||||
try {
|
||||
Configure::config('test', $reader);
|
||||
} 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
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidContainments() {
|
||||
$this->expectWarning();
|
||||
$this->_containments($this->Article, array('Comment', 'InvalidBinding'));
|
||||
}
|
||||
|
||||
|
@ -241,10 +241,10 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
/**
|
||||
* testBeforeFindWithNonExistingBinding method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testBeforeFindWithNonExistingBinding() {
|
||||
$this->expectWarning();
|
||||
$this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding')));
|
||||
}
|
||||
|
||||
|
|
|
@ -2883,16 +2883,16 @@ SQL;
|
|||
/**
|
||||
* testDropSchemaNoSchema method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @throws \PHPUnit\Framework\Error
|
||||
*/
|
||||
public function testDropSchemaNoSchema() {
|
||||
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||
try {
|
||||
$this->Dbo->dropSchema(null);
|
||||
$this->fail('No exception');
|
||||
} 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
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testBuildColumnBadType() {
|
||||
$this->expectWarning();
|
||||
$data = array(
|
||||
'name' => 'testName',
|
||||
'type' => 'varchar(255)',
|
||||
|
|
|
@ -772,10 +772,10 @@ class ModelValidationTest extends BaseModelTest {
|
|||
* Test that missing validation methods trigger errors in development mode.
|
||||
* Helps to make development easier.
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testMissingValidationErrorTriggering() {
|
||||
$this->expectWarning();
|
||||
Configure::write('debug', 2);
|
||||
|
||||
$TestModel = new ValidationTest1();
|
||||
|
@ -2226,16 +2226,16 @@ class ModelValidationTest extends BaseModelTest {
|
|||
/**
|
||||
* Test that type hint exception is thrown
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
* @throws PHPUnit_Framework_Error
|
||||
* @throws \PHPUnit\Framework\Error
|
||||
*/
|
||||
public function testValidatorTypehintException() {
|
||||
$this->expectException(\PHPUnit\Framework\Error::class);
|
||||
try {
|
||||
new ModelValidator('asdasds');
|
||||
$this->fail('No exeption raised');
|
||||
} 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
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testHashInvalidSalt() {
|
||||
$this->expectWarning();
|
||||
Security::hash('someKey', 'blowfish', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* testHashAnotherInvalidSalt
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testHashAnotherInvalidSalt() {
|
||||
$this->expectWarning();
|
||||
Security::hash('someKey', 'blowfish', '$1$lksdjoijfaoijs');
|
||||
}
|
||||
|
||||
/**
|
||||
* testHashYetAnotherInvalidSalt
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testHashYetAnotherInvalidSalt() {
|
||||
$this->expectWarning();
|
||||
Security::hash('someKey', 'blowfish', '$2a$10$123');
|
||||
}
|
||||
|
||||
/**
|
||||
* testHashInvalidCost method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testHashInvalidCost() {
|
||||
$this->expectWarning();
|
||||
Security::setCost(1000);
|
||||
}
|
||||
/**
|
||||
|
@ -269,10 +269,10 @@ class SecurityTest extends CakeTestCase {
|
|||
/**
|
||||
* testCipherEmptyKey method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testCipherEmptyKey() {
|
||||
$this->expectWarning();
|
||||
$txt = 'some_text';
|
||||
$key = '';
|
||||
Security::cipher($txt, $key);
|
||||
|
@ -321,10 +321,10 @@ class SecurityTest extends CakeTestCase {
|
|||
/**
|
||||
* testRijndaelInvalidOperation method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testRijndaelInvalidOperation() {
|
||||
$this->expectWarning();
|
||||
$txt = 'The quick brown fox jumped over the lazy dog.';
|
||||
$key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi';
|
||||
Security::rijndael($txt, $key, 'foo');
|
||||
|
@ -333,10 +333,10 @@ class SecurityTest extends CakeTestCase {
|
|||
/**
|
||||
* testRijndaelInvalidKey method
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testRijndaelInvalidKey() {
|
||||
$this->expectWarning();
|
||||
$txt = 'The quick brown fox jumped over the lazy dog.';
|
||||
$key = 'too small';
|
||||
Security::rijndael($txt, $key, 'encrypt');
|
||||
|
|
|
@ -2294,20 +2294,20 @@ class ValidationTest extends CakeTestCase {
|
|||
/**
|
||||
* test pass through failure on postal
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testPassThroughMethodFailure() {
|
||||
$this->expectWarning();
|
||||
Validation::phone('text', null, 'testNl');
|
||||
}
|
||||
|
||||
/**
|
||||
* test the pass through calling of an alternate locale with postal()
|
||||
*
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
* @return void
|
||||
*/
|
||||
public function testPassThroughClassFailure() {
|
||||
$this->expectWarning();
|
||||
Validation::postal('text', null, 'AUTOFAIL');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue