mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
cake 2.2 test case fixes (assert corrections, correct class names)
This commit is contained in:
parent
2480ee1beb
commit
bc2cd00123
17 changed files with 46 additions and 46 deletions
|
@ -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 @@ class TestTaskTest extends CakeTestCase {
|
|||
$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 @@ class TestTaskTest extends CakeTestCase {
|
|||
$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 @@ class TestTaskTest extends CakeTestCase {
|
|||
$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 @@ class TestTaskTest extends CakeTestCase {
|
|||
$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 @@ class TestTaskTest extends CakeTestCase {
|
|||
$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 @@ class CookieComponentTest extends CakeTestCase {
|
|||
'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 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
'I18n__content.locale' => 'eng'
|
||||
)
|
||||
));
|
||||
$this->assertEqual(3, $result);
|
||||
$this->assertEquals(3, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6370,7 +6370,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$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 @@ class ModelWriteTest extends BaseModelTest {
|
|||
),
|
||||
);
|
||||
$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 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$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 @@ class CakeResponseTest extends CakeTestCase {
|
|||
'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 @@ class CakeResponseTest extends CakeTestCase {
|
|||
);
|
||||
|
||||
$result = $response->cookie();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEquals($result, $expected);
|
||||
|
||||
$cookie = $expected['CakeTestCookie[Testing]'];
|
||||
$cookie['value'] = 'test';
|
||||
|
@ -1002,7 +1002,7 @@ class CakeResponseTest extends CakeTestCase {
|
|||
);
|
||||
|
||||
$result = $response->cookie();
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ App::uses('Router', 'Routing');
|
|||
*
|
||||
* @package Cake.Test.Case.Routing.Route
|
||||
*/
|
||||
class PluginShortRouteTestCase extends CakeTestCase {
|
||||
class PluginShortRouteTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
|
|
|
@ -26,7 +26,7 @@ App::uses('Router', 'Routing');
|
|||
*
|
||||
* @package Cake.Test.Case.Routing.Route
|
||||
*/
|
||||
class RedirectRouteTestCase extends CakeTestCase {
|
||||
class RedirectRouteTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
|
|
|
@ -2551,8 +2551,8 @@ class RouterTest extends CakeTestCase {
|
|||
$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 @@ class CakeNumberTest extends CakeTestCase {
|
|||
'before' => '',
|
||||
));
|
||||
$expected = '5 199 100&001';
|
||||
$this->assertEqual($expected, $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$value = 1000.45;
|
||||
$result = $this->Number->format($value, array(
|
||||
|
@ -96,7 +96,7 @@ class CakeNumberTest extends CakeTestCase {
|
|||
'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 @@ class HashTest extends CakeTestCase {
|
|||
$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 @@ class HashTest extends CakeTestCase {
|
|||
'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 @@ class HashTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3034,7 +3034,7 @@ class SetTest extends CakeTestCase {
|
|||
$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 @@ class FormHelperTest extends CakeTestCase {
|
|||
$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 @@ class HelperTest extends CakeTestCase {
|
|||
$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&three=four', $result);
|
||||
|
@ -636,10 +636,10 @@ class HelperTest extends CakeTestCase {
|
|||
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 @@ class JsonViewTest extends CakeTestCase {
|
|||
$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 @@ class JsonViewTest extends CakeTestCase {
|
|||
$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 @@ class JsonViewTest extends CakeTestCase {
|
|||
$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 @@ class ViewTest extends CakeTestCase {
|
|||
$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 @@ class ViewTest extends CakeTestCase {
|
|||
$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 @@ class XmlViewTest extends CakeTestCase {
|
|||
|
||||
$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 @@ class XmlViewTest extends CakeTestCase {
|
|||
$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 @@ class XmlViewTest extends CakeTestCase {
|
|||
$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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue