Skip to content

Commit

Permalink
Fixing tests that were failing due to SimpleTest being less sensitive…
Browse files Browse the repository at this point in the history
… to types than PHPUnit.

Fixing tests that were failing due to XmlHelper being removed in 2.0.
  • Loading branch information
markstory committed Oct 14, 2010
1 parent f19e3d5 commit 0c070f7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
Expand Up @@ -331,11 +331,11 @@ function testNonAjaxRedirect() {
* @return void
*/
function testRenderAs() {
$this->assertFalse(in_array('Xml', $this->Controller->helpers));
$this->RequestHandler->renderAs($this->Controller, 'xml');
$this->assertTrue(in_array('Xml', $this->Controller->helpers));
$this->assertFalse(in_array('Rss', $this->Controller->helpers));
$this->RequestHandler->renderAs($this->Controller, 'rss');
$this->assertTrue(in_array('Rss', $this->Controller->helpers));

$this->Controller->viewPath = 'request_handler_test\\xml';
$this->Controller->viewPath = 'request_handler_test\\rss';
$this->RequestHandler->renderAs($this->Controller, 'js');
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'js');
}
Expand Down Expand Up @@ -425,8 +425,6 @@ function testRenderAsCalledTwice() {
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'xml');
$this->assertEqual($this->Controller->layoutPath, 'xml');

$this->assertTrue(in_array('Xml', $this->Controller->helpers));

$this->RequestHandler->renderAs($this->Controller, 'js');
$this->assertEqual($this->Controller->viewPath, 'request_handler_test' . DS . 'js');
$this->assertEqual($this->Controller->layoutPath, 'js');
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/model/model_validation.test.php
Expand Up @@ -631,7 +631,7 @@ function testValidatesWithModelsAndSaveAll() {

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

$count = $Something->find('count', array('conditions' => array('Something.id' => $data['Something']['id'])));
Expand Down
22 changes: 16 additions & 6 deletions cake/tests/cases/libs/model/model_write.test.php
Expand Up @@ -2737,7 +2737,7 @@ function testSaveAllHasOneValidation() {
'Attachment' => array('attachment' => '')
),
array('validate' => 'first')
), array());
), false);
$expected = array(
'Comment' => array('comment' => 'This field cannot be left blank'),
'Attachment' => array('attachment' => 'This field cannot be left blank')
Expand Down Expand Up @@ -2990,15 +2990,25 @@ function testSaveAllManyRowsTransactionNoRollback() {
* @return void
*/
function testSaveAllAssociatedTransactionNoRollback() {
$testDb = ConnectionManager::getDataSource('test_suite');
$testDb = ConnectionManager::getDataSource('test');

Mock::generate('DboSource', 'MockTransactionAssociatedDboSource');
$db = ConnectionManager::create('mock_transaction_assoc', array(
$mock = $this->getMock('DboSource', array(), array(), 'MockTransactionAssociatedDboSource', false);
$db =& ConnectionManager::create('mock_transaction_assoc', array(
'datasource' => 'MockTransactionAssociatedDbo',
));
$this->mockObjects[] = $db;
$db->columns = $testDb->columns;

$db->expectOnce('rollback');
$db->expects($this->once())->method('rollback');
$db->expects($this->any())->method('isInterfaceSupported')
->will($this->returnValue(true));
$db->expects($this->any())->method('describe')
->will($this->returnValue(array(
'id' => array('type' => 'integer'),
'title' => array('type' => 'string'),
'body' => array('type' => 'text'),
'published' => array('type' => 'string')
)));

$Post =& new Post();
$Post->useDbConfig = 'mock_transaction_assoc';
Expand Down Expand Up @@ -3489,7 +3499,7 @@ function testSaveAllValidateFirst() {
)
), array('validate' => 'first'));

$this->assertEquals($result, array());
$this->assertFalse($result);

$result = $model->find('all');
$this->assertEqual($result, array());
Expand Down
4 changes: 2 additions & 2 deletions cake/tests/cases/libs/view/helpers/form.test.php
Expand Up @@ -2265,7 +2265,7 @@ function testInputWithMatchingFieldAndModelName() {
'key' => 'id'
)
);
$this->Form->data['User']['User'] = 'ABC, Inc.';
$this->Form->request->data['User']['User'] = 'ABC, Inc.';
$result = $this->Form->input('User', array('type' => 'text'));
$expected = array(
'div' => array('class' => 'input text'),
Expand Down Expand Up @@ -5581,7 +5581,7 @@ function testCreateQuerystringrequest() {
*/
function testCreatePassedArgs() {
$encoding = strtolower(Configure::read('App.encoding'));
$this->Form->data['Contact']['id'] = 1;
$this->Form->request->data['Contact']['id'] = 1;
$result = $this->Form->create('Contact', array(
'type' => 'post',
'escape' => false,
Expand Down

0 comments on commit 0c070f7

Please sign in to comment.