Skip to content

Commit 0c070f7

Browse files
committed
Fixing tests that were failing due to SimpleTest being less sensitive to types than PHPUnit.
Fixing tests that were failing due to XmlHelper being removed in 2.0.
1 parent f19e3d5 commit 0c070f7

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

cake/tests/cases/libs/controller/components/request_handler.test.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ function testNonAjaxRedirect() {
331331
* @return void
332332
*/
333333
function testRenderAs() {
334-
$this->assertFalse(in_array('Xml', $this->Controller->helpers));
335-
$this->RequestHandler->renderAs($this->Controller, 'xml');
336-
$this->assertTrue(in_array('Xml', $this->Controller->helpers));
334+
$this->assertFalse(in_array('Rss', $this->Controller->helpers));
335+
$this->RequestHandler->renderAs($this->Controller, 'rss');
336+
$this->assertTrue(in_array('Rss', $this->Controller->helpers));
337337

338-
$this->Controller->viewPath = 'request_handler_test\\xml';
338+
$this->Controller->viewPath = 'request_handler_test\\rss';
339339
$this->RequestHandler->renderAs($this->Controller, 'js');
340340
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'js');
341341
}
@@ -425,8 +425,6 @@ function testRenderAsCalledTwice() {
425425
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'xml');
426426
$this->assertEqual($this->Controller->layoutPath, 'xml');
427427

428-
$this->assertTrue(in_array('Xml', $this->Controller->helpers));
429-
430428
$this->RequestHandler->renderAs($this->Controller, 'js');
431429
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'js');
432430
$this->assertEqual($this->Controller->layoutPath, 'js');

cake/tests/cases/libs/model/model_validation.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ function testValidatesWithModelsAndSaveAll() {
631631

632632
$Something->create();
633633
$result = $Something->saveAll($data, array('validate' => 'first'));
634-
$this->assertEquals($result, array());
634+
$this->assertFalse($result);
635635
$this->assertEqual($JoinThing->validationErrors, $expectedError);
636636

637637
$count = $Something->find('count', array('conditions' => array('Something.id' => $data['Something']['id'])));

cake/tests/cases/libs/model/model_write.test.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,7 +2737,7 @@ function testSaveAllHasOneValidation() {
27372737
'Attachment' => array('attachment' => '')
27382738
),
27392739
array('validate' => 'first')
2740-
), array());
2740+
), false);
27412741
$expected = array(
27422742
'Comment' => array('comment' => 'This field cannot be left blank'),
27432743
'Attachment' => array('attachment' => 'This field cannot be left blank')
@@ -2990,15 +2990,25 @@ function testSaveAllManyRowsTransactionNoRollback() {
29902990
* @return void
29912991
*/
29922992
function testSaveAllAssociatedTransactionNoRollback() {
2993-
$testDb = ConnectionManager::getDataSource('test_suite');
2993+
$testDb = ConnectionManager::getDataSource('test');
29942994

2995-
Mock::generate('DboSource', 'MockTransactionAssociatedDboSource');
2996-
$db = ConnectionManager::create('mock_transaction_assoc', array(
2995+
$mock = $this->getMock('DboSource', array(), array(), 'MockTransactionAssociatedDboSource', false);
2996+
$db =& ConnectionManager::create('mock_transaction_assoc', array(
29972997
'datasource' => 'MockTransactionAssociatedDbo',
29982998
));
2999+
$this->mockObjects[] = $db;
29993000
$db->columns = $testDb->columns;
30003001

3001-
$db->expectOnce('rollback');
3002+
$db->expects($this->once())->method('rollback');
3003+
$db->expects($this->any())->method('isInterfaceSupported')
3004+
->will($this->returnValue(true));
3005+
$db->expects($this->any())->method('describe')
3006+
->will($this->returnValue(array(
3007+
'id' => array('type' => 'integer'),
3008+
'title' => array('type' => 'string'),
3009+
'body' => array('type' => 'text'),
3010+
'published' => array('type' => 'string')
3011+
)));
30023012

30033013
$Post =& new Post();
30043014
$Post->useDbConfig = 'mock_transaction_assoc';
@@ -3489,7 +3499,7 @@ function testSaveAllValidateFirst() {
34893499
)
34903500
), array('validate' => 'first'));
34913501

3492-
$this->assertEquals($result, array());
3502+
$this->assertFalse($result);
34933503

34943504
$result = $model->find('all');
34953505
$this->assertEqual($result, array());

cake/tests/cases/libs/view/helpers/form.test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,7 @@ function testInputWithMatchingFieldAndModelName() {
22652265
'key' => 'id'
22662266
)
22672267
);
2268-
$this->Form->data['User']['User'] = 'ABC, Inc.';
2268+
$this->Form->request->data['User']['User'] = 'ABC, Inc.';
22692269
$result = $this->Form->input('User', array('type' => 'text'));
22702270
$expected = array(
22712271
'div' => array('class' => 'input text'),
@@ -5581,7 +5581,7 @@ function testCreateQuerystringrequest() {
55815581
*/
55825582
function testCreatePassedArgs() {
55835583
$encoding = strtolower(Configure::read('App.encoding'));
5584-
$this->Form->data['Contact']['id'] = 1;
5584+
$this->Form->request->data['Contact']['id'] = 1;
55855585
$result = $this->Form->create('Contact', array(
55865586
'type' => 'post',
55875587
'escape' => false,

0 commit comments

Comments
 (0)