diff --git a/lib/Cake/Test/Case/Console/Command/AclShellTest.php b/lib/Cake/Test/Case/Console/Command/AclShellTest.php index cc8c2217d22..7efc4fa7c37 100644 --- a/lib/Cake/Test/Case/Console/Command/AclShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/AclShellTest.php @@ -77,13 +77,13 @@ public function testViewWithModelForeignKeyOutput() { $this->Task->expects($this->at(0))->method('out')->with('Aro tree:'); $this->Task->expects($this->at(2))->method('out') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/\[1\] ROOT/')); + ->with($this->stringContains('[1] ROOT')); $this->Task->expects($this->at(4))->method('out') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/\[3\] Gandalf/')); + ->with($this->stringContains('[3] Gandalf')); $this->Task->expects($this->at(6))->method('out') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/\[5\] MyModel\.2/')); + ->with($this->stringContains('[5] MyModel.2')); $this->Task->view(); } @@ -216,7 +216,7 @@ public function testGrant() { public function testDeny() { $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->expects($this->at(0))->method('out') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/Permission denied/'), true); + ->with($this->stringContains('Permission denied'), true); $this->Task->deny(); diff --git a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php index c0126d279ff..76d508a541f 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php @@ -314,7 +314,7 @@ public function testBakeWithPlugin() { ); $this->Task->expects($this->at(3))->method('createFile')->with( $path, - new PHPUnit_Framework_Constraint_PCREMatch('/ArticlesController extends ControllerTestAppController/') + $this->stringContains('ArticlesController extends ControllerTestAppController') )->will($this->returnValue(true)); $this->Task->bake('Articles', '--actions--', array(), array(), array()); @@ -450,7 +450,7 @@ public function testInteractive() { $filename = '/my/path/BakeArticlesController.php'; $this->Task->expects($this->once())->method('createFile')->with( $filename, - new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesController/') + $this->stringContains('class BakeArticlesController') ); $this->Task->execute(); } @@ -490,7 +490,7 @@ public function testInteractiveAdminMethodsNotInteractive() { $filename = '/my/path/BakeArticlesController.php'; $this->Task->expects($this->once())->method('createFile')->with( $filename, - new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesController/') + $this->stringContains('class BakeArticlesController') )->will($this->returnValue(true)); $result = $this->Task->execute(); @@ -520,7 +520,7 @@ public function testExecuteIntoAll() { $filename = '/my/path/BakeArticlesController.php'; $this->Task->expects($this->once())->method('createFile')->with( $filename, - new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesController/') + $this->stringContains('class BakeArticlesController') )->will($this->returnValue(true)); $this->Task->execute(); @@ -542,7 +542,7 @@ public function testExecuteWithController() { $filename = '/my/path/BakeArticlesController.php'; $this->Task->expects($this->once())->method('createFile')->with( $filename, - new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/') + $this->stringContains('$scaffold') ); $this->Task->execute(); @@ -575,7 +575,7 @@ public function testExecuteWithControllerNameVariations($name) { $filename = '/my/path/BakeArticlesController.php'; $this->Task->expects($this->once())->method('createFile')->with( - $filename, new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/') + $filename, $this->stringContains('$scaffold') ); $this->Task->execute(); } @@ -595,7 +595,7 @@ public function testExecuteWithPublicParam() { $this->Task->params = array('public' => true); $filename = '/my/path/BakeArticlesController.php'; - $expected = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/')); + $expected = new PHPUnit_Framework_Constraint_Not($this->stringContains('$scaffold')); $this->Task->expects($this->once())->method('createFile')->with( $filename, $expected ); @@ -619,7 +619,7 @@ public function testExecuteWithControllerAndBoth() { $filename = '/my/path/BakeArticlesController.php'; $this->Task->expects($this->once())->method('createFile')->with( - $filename, new PHPUnit_Framework_Constraint_PCREMatch('/admin_index/') + $filename, $this->stringContains('admin_index') ); $this->Task->execute(); } @@ -641,7 +641,7 @@ public function testExecuteWithControllerAndAdmin() { $filename = '/my/path/BakeArticlesController.php'; $this->Task->expects($this->once())->method('createFile')->with( - $filename, new PHPUnit_Framework_Constraint_PCREMatch('/admin_index/') + $filename, $this->stringContains('admin_index') ); $this->Task->execute(); } diff --git a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php index 0d2db444a36..3a798e517fd 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php @@ -270,7 +270,7 @@ public function testInteractiveFieldValidationWithBogusResponse() { ->will($this->onConsecutiveCalls('999999', '21', 'n')); $this->Task->expects($this->at(7))->method('out') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/make a valid/')); + ->with($this->stringContains('make a valid')); $result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false)); $expected = array('notempty' => 'notempty'); @@ -752,7 +752,7 @@ public function testBakeWithPlugin() { CakePlugin::load('ControllerTest', array('path' => APP . 'Plugin' . DS . 'ControllerTest' . DS)); $path = APP . 'Plugin' . DS . 'ControllerTest' . DS . 'Model' . DS . 'BakeArticle.php'; $this->Task->expects($this->once())->method('createFile') - ->with($path, new PHPUnit_Framework_Constraint_PCREMatch('/BakeArticle extends ControllerTestAppModel/')); + ->with($path, $this->stringContains('BakeArticle extends ControllerTestAppModel')); $result = $this->Task->bake('BakeArticle', array(), array()); $this->assertContains("App::uses('ControllerTestAppModel', 'ControllerTest.Model');", $result); @@ -774,7 +774,7 @@ public function testExecuteWithNamedModel() { $this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1)); $this->Task->expects($this->once())->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle extends AppModel/')); + ->with($filename, $this->stringContains('class BakeArticle extends AppModel')); $this->Task->execute(); @@ -808,7 +808,7 @@ public function testExecuteWithNamedModelVariations($name) { $filename = '/my/path/BakeArticle.php'; $this->Task->expects($this->at(0))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle extends AppModel/')); + ->with($filename, $this->stringContains('class BakeArticle extends AppModel')); $this->Task->execute(); } @@ -825,7 +825,7 @@ public function testExecuteWithNamedModelHasManyCreated() { $this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1)); $this->Task->expects($this->at(0))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch("/'BakeComment' \=\> array\(/")); + ->with($filename, $this->stringContains("'BakeComment' => array(")); $this->Task->execute(); } @@ -851,23 +851,23 @@ public function testExecuteIntoAll() { $filename = '/my/path/BakeArticle.php'; $this->Task->expects($this->at(1))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/')); + ->with($filename, $this->stringContains('class BakeArticle')); $filename = '/my/path/BakeArticlesBakeTag.php'; $this->Task->expects($this->at(2))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesBakeTag/')); + ->with($filename, $this->stringContains('class BakeArticlesBakeTag')); $filename = '/my/path/BakeComment.php'; $this->Task->expects($this->at(3))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeComment/')); + ->with($filename, $this->stringContains('class BakeComment')); $filename = '/my/path/BakeTag.php'; $this->Task->expects($this->at(4)) - ->method('createFile')->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeTag/')); + ->method('createFile')->with($filename, $this->stringContains('class BakeTag')); $filename = '/my/path/CategoryThread.php'; $this->Task->expects($this->at(5))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class CategoryThread/')); + ->with($filename, $this->stringContains('class CategoryThread')); $this->Task->execute(); @@ -897,19 +897,19 @@ public function testSkipTablesAndAll() { $filename = '/my/path/BakeArticle.php'; $this->Task->expects($this->at(1))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/')); + ->with($filename, $this->stringContains('class BakeArticle')); $filename = '/my/path/BakeArticlesBakeTag.php'; $this->Task->expects($this->at(2))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesBakeTag/')); + ->with($filename, $this->stringContains('class BakeArticlesBakeTag')); $filename = '/my/path/BakeComment.php'; $this->Task->expects($this->at(3))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeComment/')); + ->with($filename, $this->stringContains('class BakeComment')); $filename = '/my/path/CategoryThread.php'; $this->Task->expects($this->at(4))->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class CategoryThread/')); + ->with($filename, $this->stringContains('class CategoryThread')); $this->Task->execute(); } @@ -948,7 +948,7 @@ public function testExecuteIntoInteractive() { $filename = '/my/path/BakeArticle.php'; $this->Task->expects($this->once())->method('createFile') - ->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/')); + ->with($filename, $this->stringContains('class BakeArticle')); $this->Task->execute(); diff --git a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php index 4e061d11e61..8a326b84ae3 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php @@ -600,7 +600,7 @@ public function testExecuteWithOneArg() { $this->Task->expects($this->once())->method('createFile') ->with( new PHPUnit_Framework_Constraint_IsAnything(), - new PHPUnit_Framework_Constraint_PCREMatch('/class TestTaskTagTestCase extends CakeTestCase/') + $this->stringContains('class TestTaskTagTestCase extends CakeTestCase') ); $this->Task->execute(); } @@ -616,7 +616,7 @@ public function testExecuteWithTwoArgs() { $this->Task->expects($this->once())->method('createFile') ->with( new PHPUnit_Framework_Constraint_IsAnything(), - new PHPUnit_Framework_Constraint_PCREMatch('/class TestTaskTagTestCase extends CakeTestCase/') + $this->stringContains('class TestTaskTagTestCase extends CakeTestCase') ); $this->Task->expects($this->any())->method('isLoadableClass')->will($this->returnValue(true)); $this->Task->execute(); diff --git a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php index ad6b5acda0d..238b97c19e4 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php @@ -322,7 +322,7 @@ public function testBakeView() { $this->Task->expects($this->at(0))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'view.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/View Task Articles/') + $this->stringContains('View Task Articles') ); $this->Task->bake('view', true); @@ -355,7 +355,7 @@ public function testBakeIndex() { $this->Task->expects($this->at(0))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'index.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/\$viewTaskComment\[\'Article\'\]\[\'title\'\]/') + $this->stringContains("\$viewTaskComment['Article']['title']") ); $this->Task->bake('index', true); } @@ -403,17 +403,17 @@ public function testBakeActions() { $this->Task->expects($this->at(0))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'view.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/View Task Comments/') + $this->stringContains('View Task Comments') ); $this->Task->expects($this->at(1))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'edit.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/Edit View Task Comment/') + $this->stringContains('Edit View Task Comment') ); $this->Task->expects($this->at(2))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'index.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/') + $this->stringContains('ViewTaskComment') ); $this->Task->bakeActions(array('view', 'edit', 'index'), array()); @@ -606,25 +606,25 @@ public function testExecuteInteractive() { $this->Task->expects($this->at(3))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'index.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/') + $this->stringContains('ViewTaskComment') ); $this->Task->expects($this->at(4))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'view.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/') + $this->stringContains('ViewTaskComment') ); $this->Task->expects($this->at(5))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'add.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/Add View Task Comment/') + $this->stringContains('Add View Task Comment') ); $this->Task->expects($this->at(6))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'edit.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/Edit View Task Comment/') + $this->stringContains('Edit View Task Comment') ); $this->Task->expects($this->exactly(4))->method('createFile'); @@ -644,7 +644,7 @@ public function testExecuteWithAlternateTemplates() { $this->Task->expects($this->once())->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'list.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/') + $this->stringContains('ViewTaskComment') ); $this->Task->execute(); } @@ -671,25 +671,25 @@ public function testExecuteInteractiveWithAdmin() { $this->Task->expects($this->at(3))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'admin_index.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/') + $this->stringContains('ViewTaskComment') ); $this->Task->expects($this->at(4))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'admin_view.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/ViewTaskComment/') + $this->stringContains('ViewTaskComment') ); $this->Task->expects($this->at(5))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'admin_add.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/Add View Task Comment/') + $this->stringContains('Add View Task Comment') ); $this->Task->expects($this->at(6))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'admin_edit.ctp', - new PHPUnit_Framework_Constraint_PCREMatch('/Edit View Task Comment/') + $this->stringContains('Edit View Task Comment') ); $this->Task->expects($this->exactly(4))->method('createFile'); diff --git a/lib/Cake/Test/Case/Console/Command/TestsuiteShellTest.php b/lib/Cake/Test/Case/Console/Command/TestsuiteShellTest.php index 5db68501522..dc0ec4e1a96 100644 --- a/lib/Cake/Test/Case/Console/Command/TestsuiteShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/TestsuiteShellTest.php @@ -72,9 +72,9 @@ public function testAvailableCoreCategory() { $this->Shell->args = array('core'); $this->Shell->expects($this->at(0))->method('out')->with('Core Test Cases:'); $this->Shell->expects($this->at(1))->method('out') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/\[1\].*/')); + ->with($this->stringContains('[1]')); $this->Shell->expects($this->at(2))->method('out') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/\[2\].*/')); + ->with($this->stringContains('[2]')); $this->Shell->expects($this->once())->method('in') ->with(__d('cake_console', 'What test case would you like to run?'), null, 'q') diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php index be4635ee7bd..73f065251f3 100644 --- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php @@ -1055,10 +1055,10 @@ public function testGenerateInnerJoinAssociationQuery() { ->will($this->returnValue($test)); $test->expects($this->at(0))->method('execute') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/`TestModel9` LEFT JOIN `test_model8`/')); + ->with($this->stringContains('`TestModel9` LEFT JOIN `test_model8`')); $test->expects($this->at(1))->method('execute') - ->with(new PHPUnit_Framework_Constraint_PCREMatch('/`TestModel9` INNER JOIN `test_model8`/')); + ->with($this->stringContains('TestModel9` INNER JOIN `test_model8`')); $test->read($this->Model, array('recursive' => 1)); $this->Model->belongsTo['TestModel8']['type'] = 'INNER';