test: Replace PHPUnit's class name in tests

Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
This commit is contained in:
Koji Tanaka 2023-01-07 11:13:47 +09:00 committed by Kamil Wylegala
parent 75437a4a85
commit 2a7c06e16f
8 changed files with 15 additions and 14 deletions

View file

@ -410,7 +410,7 @@ class CacheTest extends CakeTestCase {
try { try {
Cache::write('fail', 'value', 'test_trigger'); Cache::write('fail', 'value', 'test_trigger');
$this->fail('No exception thrown'); $this->fail('No exception thrown');
} catch (PHPUnit_Framework_Error $e) { } catch (PHPUnit\Framework\Error\Error $e) {
$this->assertTrue(true); $this->assertTrue(true);
} }
Cache::drop('test_trigger'); Cache::drop('test_trigger');

View file

@ -313,7 +313,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->expects($this->once())->method('in')->will($this->returnValue('o')); $this->Shell->expects($this->once())->method('in')->will($this->returnValue('o'));
$this->Shell->expects($this->at(2))->method('out') $this->Shell->expects($this->at(2))->method('out')
->with(new PHPUnit_Framework_Constraint_PCREMatch('/Schema file:\s[a-z\.]+\sgenerated/')); ->with(new PHPUnit\Framework\Constraint\RegularExpression('/Schema file:\s[a-z\.]+\sgenerated/'));
$this->Shell->Schema = $this->getMock('CakeSchema'); $this->Shell->Schema = $this->getMock('CakeSchema');
$this->Shell->Schema->path = TMP; $this->Shell->Schema->path = TMP;

View file

@ -307,7 +307,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->expects($this->at(1))->method('createFile')->with( $this->Task->expects($this->at(1))->method('createFile')->with(
$path, $path,
new PHPUnit_Framework_Constraint_IsAnything() new \PHPUnit\Framework\Constraint\IsAnything()
); );
$this->Task->expects($this->at(3))->method('createFile')->with( $this->Task->expects($this->at(3))->method('createFile')->with(
$path, $path,
@ -571,7 +571,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->params = array('public' => true); $this->Task->params = array('public' => true);
$filename = '/my/path/BakeArticlesController.php'; $filename = '/my/path/BakeArticlesController.php';
$expected = new PHPUnit_Framework_Constraint_Not($this->stringContains('$scaffold')); $expected = new PHPUnit\Framework\Constraint\LogicalNot($this->stringContains('$scaffold'));
$this->Task->expects($this->once())->method('createFile')->with( $this->Task->expects($this->once())->method('createFile')->with(
$filename, $expected $filename, $expected
); );

View file

@ -528,7 +528,7 @@ class ModelTaskTest extends CakeTestCase {
'two' => array(), 'two' => array(),
'key' => array('key' => 'primary') 'key' => array('key' => 'primary')
); );
$anything = new PHPUnit_Framework_Constraint_IsAnything(); $anything = new \PHPUnit\Framework\Constraint\IsAnything();
$this->Task->expects($this->once())->method('in') $this->Task->expects($this->once())->method('in')
->with($anything, null, 'key') ->with($anything, null, 'key')
->will($this->returnValue('my_field')); ->will($this->returnValue('my_field'));

View file

@ -92,12 +92,12 @@ class PluginTaskTest extends CakeTestCase {
$file = $path . DS . 'Controller' . DS . 'BakeTestPluginAppController.php'; $file = $path . DS . 'Controller' . DS . 'BakeTestPluginAppController.php';
$this->Task->expects($this->at(2)) $this->Task->expects($this->at(2))
->method('createFile') ->method('createFile')
->with($file, new PHPUnit_Framework_Constraint_IsAnything()); ->with($file, new \PHPUnit\Framework\Constraint\IsAnything());
$file = $path . DS . 'Model' . DS . 'BakeTestPluginAppModel.php'; $file = $path . DS . 'Model' . DS . 'BakeTestPluginAppModel.php';
$this->Task->expects($this->at(3)) $this->Task->expects($this->at(3))
->method('createFile') ->method('createFile')
->with($file, new PHPUnit_Framework_Constraint_IsAnything()); ->with($file, new \PHPUnit\Framework\Constraint\IsAnything());
$this->Task->bake('BakeTestPlugin'); $this->Task->bake('BakeTestPlugin');
@ -148,11 +148,11 @@ class PluginTaskTest extends CakeTestCase {
$file = $path . DS . 'Controller' . DS . 'TestPluginAppController.php'; $file = $path . DS . 'Controller' . DS . 'TestPluginAppController.php';
$this->Task->expects($this->at(3))->method('createFile') $this->Task->expects($this->at(3))->method('createFile')
->with($file, new PHPUnit_Framework_Constraint_IsAnything()); ->with($file, $this->anything());
$file = $path . DS . 'Model' . DS . 'TestPluginAppModel.php'; $file = $path . DS . 'Model' . DS . 'TestPluginAppModel.php';
$this->Task->expects($this->at(4))->method('createFile') $this->Task->expects($this->at(4))->method('createFile')
->with($file, new PHPUnit_Framework_Constraint_IsAnything()); ->with($file, $this->anything());
$this->Task->args = array(); $this->Task->args = array();
$this->Task->execute(); $this->Task->execute();
@ -175,12 +175,12 @@ class PluginTaskTest extends CakeTestCase {
$path = $this->Task->path . 'BakeTestPlugin'; $path = $this->Task->path . 'BakeTestPlugin';
$file = $path . DS . 'Controller' . DS . 'BakeTestPluginAppController.php'; $file = $path . DS . 'Controller' . DS . 'BakeTestPluginAppController.php';
$this->Task->expects($this->at(2))->method('createFile') $this->Task->expects($this->at(2))->method('createFile')
->with($file, new PHPUnit_Framework_Constraint_IsAnything()); ->with($file, new \PHPUnit\Framework\Constraint\IsAnything());
$path = $this->Task->path . 'BakeTestPlugin'; $path = $this->Task->path . 'BakeTestPlugin';
$file = $path . DS . 'Model' . DS . 'BakeTestPluginAppModel.php'; $file = $path . DS . 'Model' . DS . 'BakeTestPluginAppModel.php';
$this->Task->expects($this->at(3))->method('createFile') $this->Task->expects($this->at(3))->method('createFile')
->with($file, new PHPUnit_Framework_Constraint_IsAnything()); ->with($file, new \PHPUnit\Framework\Constraint\IsAnything());
$this->Task->args = array('BakeTestPlugin'); $this->Task->args = array('BakeTestPlugin');

View file

@ -310,7 +310,7 @@ class ViewTaskTest extends CakeTestCase {
$this->Task->expects($this->at(0))->method('createFile') $this->Task->expects($this->at(0))->method('createFile')
->with( ->with(
TMP . 'ViewTaskComments' . DS . 'edit.ctp', TMP . 'ViewTaskComments' . DS . 'edit.ctp',
new PHPUnit_Framework_Constraint_IsAnything() new \PHPUnit\Framework\Constraint\IsAnything()
); );
$this->Task->bake('edit', true); $this->Task->bake('edit', true);
} }

View file

@ -342,7 +342,8 @@ class PhpAclTest extends CakeTestCase {
), ),
); );
$this->expectError('PHPUnit_Framework_Error', 'cycle detected' /* ... */); $this->expectError();
$this->expectErrorMessage('cycle detected');
$this->PhpAcl->build($config); $this->PhpAcl->build($config);
} }

View file

@ -260,7 +260,7 @@ class FolderTest extends CakeTestCase {
$Folder = new Folder($path); $Folder = new Folder($path);
$result = $Folder->create($path . DS . 'two' . DS . 'three'); $result = $Folder->create($path . DS . 'two' . DS . 'three');
$this->assertFalse($result); $this->assertFalse($result);
} catch (PHPUnit_Framework_Error $e) { } catch (\PHPUnit\Framework\Error\Error $e) {
$this->assertTrue(true); $this->assertTrue(true);
} }