Permalink
Browse files

cake 2.2 test case fixes (assert corrections, correct class names)

  • Loading branch information...
1 parent 2480ee1 commit bc2cd00123df0e0f983d3eeeb28aa0e165667b4c @dereuromark dereuromark committed Apr 21, 2012
@@ -54,7 +54,7 @@ class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
* <?php echo $fullClassName; ?> Test Case
*
*/
-class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {
+class <?php echo $fullClassName; ?>Test extends CakeTestCase {
<?php if (!empty($fixtures)): ?>
/**
* Fixtures
@@ -437,7 +437,7 @@ public function testBakeModelTest() {
$result = $this->Task->bake('Model', 'TestTaskArticle');
$this->assertContains("App::uses('TestTaskArticle', 'Model')", $result);
- $this->assertContains('class TestTaskArticleTestCase extends CakeTestCase', $result);
+ $this->assertContains('class TestTaskArticleTest extends CakeTestCase', $result);
$this->assertContains('function setUp()', $result);
$this->assertContains("\$this->TestTaskArticle = ClassRegistry::init('TestTaskArticle')", $result);
@@ -468,7 +468,7 @@ public function testBakeControllerTest() {
$result = $this->Task->bake('Controller', 'TestTaskComments');
$this->assertContains("App::uses('TestTaskCommentsController', 'Controller')", $result);
- $this->assertContains('class TestTaskCommentsControllerTestCase extends CakeTestCase', $result);
+ $this->assertContains('class TestTaskCommentsControllerTest extends CakeTestCase', $result);
$this->assertContains('class TestTestTaskCommentsController extends TestTaskCommentsController', $result);
$this->assertContains('public $autoRender = false', $result);
@@ -655,7 +655,7 @@ public function testExecuteWithOneArg() {
$this->Task->expects($this->once())->method('createFile')
->with(
$this->anything(),
- $this->stringContains('class TestTaskTagTestCase extends CakeTestCase')
+ $this->stringContains('class TestTaskTagTest extends CakeTestCase')
);
$this->Task->execute();
}
@@ -671,7 +671,7 @@ public function testExecuteWithTwoArgs() {
$this->Task->expects($this->once())->method('createFile')
->with(
$this->anything(),
- $this->stringContains('class TestTaskTagTestCase extends CakeTestCase')
+ $this->stringContains('class TestTaskTagTest extends CakeTestCase')
);
$this->Task->expects($this->any())->method('isLoadableClass')->will($this->returnValue(true));
$this->Task->execute();
@@ -688,7 +688,7 @@ public function testExecuteWithTwoArgsLowerCase() {
$this->Task->expects($this->once())->method('createFile')
->with(
$this->anything(),
- $this->stringContains('class TestTaskTagTestCase extends CakeTestCase')
+ $this->stringContains('class TestTaskTagTest extends CakeTestCase')
);
$this->Task->expects($this->any())->method('isLoadableClass')->will($this->returnValue(true));
$this->Task->execute();
@@ -518,10 +518,10 @@ public function testReadEmpty() {
'Empty' => '',
'String' => '{"somewhat:"broken"}'
);
- $this->assertEqual(array('name' => 'value'), $this->Cookie->read('JSON'));
- $this->assertEqual('value', $this->Cookie->read('JSON.name'));
- $this->assertEqual('', $this->Cookie->read('Empty'));
- $this->assertEqual('{"somewhat:"broken"}', $this->Cookie->read('String'));
+ $this->assertEquals(array('name' => 'value'), $this->Cookie->read('JSON'));
+ $this->assertEquals('value', $this->Cookie->read('JSON.name'));
+ $this->assertEquals('', $this->Cookie->read('Empty'));
+ $this->assertEquals('{"somewhat:"broken"}', $this->Cookie->read('String'));
}
/**
@@ -64,7 +64,7 @@ public function testCountWithConditions() {
'I18n__content.locale' => 'eng'
)
));
- $this->assertEqual(3, $result);
+ $this->assertEquals(3, $result);
}
/**
@@ -6370,7 +6370,7 @@ public function testSaveAllFieldListValidateBelongsTo() {
$TestModel = new Post();
$result = $TestModel->find('all');
- $this->assertEqual(3, count($result));
+ $this->assertEquals(3, count($result));
$this->assertFalse(isset($result[3]));
$ts = date('Y-m-d H:i:s');
@@ -6411,7 +6411,7 @@ public function testSaveAllFieldListValidateBelongsTo() {
),
);
$this->assertEquals($expected, $result[3]);
- $this->assertEqual(4, count($result));
+ $this->assertEquals(4, count($result));
$this->assertEquals('', $result[3]['Post']['body']);
$this->assertEquals('working', $result[3]['Author']['test']);
@@ -6542,7 +6542,7 @@ public function testSaveAllDeepFieldListValidateBelongsTo() {
$TestModel->recursive = 2;
$result = $TestModel->find('all');
- $this->assertEqual(3, count($result));
+ $this->assertEquals(3, count($result));
$this->assertFalse(isset($result[3]));
$ts = date('Y-m-d H:i:s');
@@ -943,7 +943,7 @@ public function testCookieSettings() {
'secure' => false,
'httpOnly' => false);
$result = $response->cookie('CakeTestCookie[Testing]');
- $this->assertEqual($result, $expected);
+ $this->assertEquals($result, $expected);
$cookie = array(
'name' => 'CakeTestCookie[Testing2]',
@@ -975,7 +975,7 @@ public function testCookieSettings() {
);
$result = $response->cookie();
- $this->assertEqual($result, $expected);
+ $this->assertEquals($result, $expected);
$cookie = $expected['CakeTestCookie[Testing]'];
$cookie['value'] = 'test';
@@ -1002,7 +1002,7 @@ public function testCookieSettings() {
);
$result = $response->cookie();
- $this->assertEqual($result, $expected);
+ $this->assertEquals($result, $expected);
}
}
@@ -25,7 +25,7 @@
*
* @package Cake.Test.Case.Routing.Route
*/
-class PluginShortRouteTestCase extends CakeTestCase {
+class PluginShortRouteTest extends CakeTestCase {
/**
* setUp method
@@ -26,7 +26,7 @@
*
* @package Cake.Test.Case.Routing.Route
*/
-class RedirectRouteTestCase extends CakeTestCase {
+class RedirectRouteTest extends CakeTestCase {
/**
* setUp method
@@ -2551,8 +2551,8 @@ public function testDefaultRouteClassGetter() {
$routeClass = 'TestDefaultRouteClass';
Router::defaultRouteClass($routeClass);
- $this->assertEqual($routeClass, Router::defaultRouteClass());
- $this->assertEqual($routeClass, Router::defaultRouteClass(null));
+ $this->assertEquals($routeClass, Router::defaultRouteClass());
+ $this->assertEquals($routeClass, Router::defaultRouteClass(null));
}
/**
@@ -87,7 +87,7 @@ public function testMultibyteFormat() {
'before' => '',
));
$expected = '5&nbsp;199&nbsp;100&amp;001';
- $this->assertEqual($expected, $result);
+ $this->assertEquals($expected, $result);
$value = 1000.45;
$result = $this->Number->format($value, array(
@@ -96,7 +96,7 @@ public function testMultibyteFormat() {
'escape' => false,
));
$expected = '$1,,000.a45';
- $this->assertEqual($expected, $result);
+ $this->assertEquals($expected, $result);
$value = 519919827593784.00;
$this->Number->addFormat('RUR', array(
@@ -2088,7 +2088,7 @@ public function testExpand() {
$data = array('My', 'Array', 'To', 'Flatten');
$flat = Hash::flatten($data);
$result = Hash::expand($flat);
- $this->assertEqual($data, $result);
+ $this->assertEquals($data, $result);
$data = array(
'0.Post.id' => '1', '0.Post.author_id' => '1', '0.Post.title' => 'First Post', '0.Author.id' => '1',
@@ -2107,7 +2107,7 @@ public function testExpand() {
'Author' => array('id' => '3', 'user' => 'larry', 'password' => null),
)
);
- $this->assertEqual($result, $expected);
+ $this->assertEquals($result, $expected);
$data = array(
'0/Post/id' => 1,
@@ -2122,7 +2122,7 @@ public function testExpand() {
)
)
);
- $this->assertEqual($result, $expected);
+ $this->assertEquals($result, $expected);
}
}
@@ -3034,7 +3034,7 @@ public function testExpand() {
$data = array('My', 'Array', 'To', 'Flatten');
$flat = Set::flatten($data);
$result = Set::expand($flat);
- $this->assertEqual($data, $result);
+ $this->assertEquals($data, $result);
}
/**
@@ -1492,12 +1492,12 @@ public function testTagIsInvalid() {
$this->Form->setEntity('Contact.1.email');
$result = $this->Form->tagIsInvalid();
$expected = false;
- $this->assertIdentical($expected, $result);
+ $this->assertSame($expected, $result);
$this->Form->setEntity('Contact.0.name');
$result = $this->Form->tagIsInvalid();
$expected = false;
- $this->assertIdentical($expected, $result);
+ $this->assertSame($expected, $result);
}
/**
@@ -620,7 +620,7 @@ public function testAssetUrl() {
$this->assertEquals(FULL_BASE_URL . '/foo.jpg', $result);
$result = $this->Helper->assetUrl('style', array('ext' => '.css'));
- $this->assertEqual('style.css', $result);
+ $this->assertEquals('style.css', $result);
$result = $this->Helper->assetUrl('foo.jpg?one=two&three=four');
$this->assertEquals('foo.jpg?one=two&amp;three=four', $result);
@@ -636,10 +636,10 @@ public function testAssetUrlPlugin() {
CakePlugin::load('TestPlugin');
$result = $this->Helper->assetUrl('TestPlugin.style', array('ext' => '.css'));
- $this->assertEqual('test_plugin/style.css', $result);
+ $this->assertEquals('test_plugin/style.css', $result);
$result = $this->Helper->assetUrl('TestPlugin.style', array('ext' => '.css', 'plugin' => false));
- $this->assertEqual('TestPlugin.style.css', $result);
+ $this->assertEquals('TestPlugin.style.css', $result);
CakePlugin::unload('TestPlugin');
}
@@ -43,8 +43,8 @@ public function testRenderWithoutView() {
$View = new JsonView($Controller);
$output = $View->render(false);
- $this->assertIdentical(json_encode($data), $output);
- $this->assertIdentical('application/json', $Response->type());
+ $this->assertSame(json_encode($data), $output);
+ $this->assertSame('application/json', $Response->type());
}
/**
@@ -62,8 +62,8 @@ public function testRenderWithoutViewMultiple() {
$View = new JsonView($Controller);
$output = $View->render(false);
- $this->assertIdentical(json_encode(array('no' => $data['no'], 'user' => $data['user'])), $output);
- $this->assertIdentical('application/json', $Response->type());
+ $this->assertSame(json_encode(array('no' => $data['no'], 'user' => $data['user'])), $output);
+ $this->assertSame('application/json', $Response->type());
}
/**
@@ -94,8 +94,8 @@ public function testRenderWithView() {
$output = $View->render('index');
$expected = json_encode(array('user' => 'fake', 'list' => array('item1', 'item2')));
- $this->assertIdentical($expected, $output);
- $this->assertIdentical('application/json', $Response->type());
+ $this->assertSame($expected, $output);
+ $this->assertSame('application/json', $Response->type());
}
}
@@ -640,8 +640,8 @@ public function testElement() {
$this->assertEquals('this is the plugin element using params[plugin]', $result);
$result = $this->View->element('test_plugin.plugin_element');
- $this->assertPattern('/Not Found:/', $result);
- $this->assertPattern('/test_plugin.plugin_element/', $result);
+ $this->assertRegExp('/Not Found:/', $result);
+ $this->assertRegExp('/test_plugin.plugin_element/', $result);
$this->View->plugin = 'TestPlugin';
$result = $this->View->element('test_plugin_element');
@@ -1040,7 +1040,7 @@ public function testViewFileName() {
$this->assertRegExp('/Posts(\/|\\\)index.ctp/', $result);
$result = $View->getViewFileName('TestPlugin.index');
- $this->assertPattern('/Posts(\/|\\\)index.ctp/', $result);
+ $this->assertRegExp('/Posts(\/|\\\)index.ctp/', $result);
$result = $View->getViewFileName('/Pages/home');
$this->assertRegExp('/Pages(\/|\\\)home.ctp/', $result);
@@ -45,7 +45,7 @@ public function testRenderWithoutView() {
$expected = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<users><user>user1</user><user>user2</user></users>';
$this->assertTextEquals($expected, trim($output));
- $this->assertIdentical('application/xml', $Response->type());
+ $this->assertSame('application/xml', $Response->type());
}
/**
@@ -66,8 +66,8 @@ public function testRenderWithoutViewMultiple() {
$expected = array(
'response' => array('no' => $data['no'], 'user' => $data['user'])
);
- $this->assertIdentical(Xml::build($expected)->asXML(), $output);
- $this->assertIdentical('application/xml', $Response->type());
+ $this->assertSame(Xml::build($expected)->asXML(), $output);
+ $this->assertSame('application/xml', $Response->type());
}
/**
@@ -101,8 +101,8 @@ public function testRenderWithView() {
$output = $View->render('index');
$expected = '<?xml version="1.0" encoding="UTF-8"?><users><user>user1</user><user>user2</user></users>';
- $this->assertIdentical($expected, str_replace(array("\r", "\n"), '', $output));
- $this->assertIdentical('application/xml', $Response->type());
+ $this->assertSame($expected, str_replace(array("\r", "\n"), '', $output));
+ $this->assertSame('application/xml', $Response->type());
$this->assertInstanceOf('HelperCollection', $View->Helpers);
}

0 comments on commit bc2cd00

Please sign in to comment.