mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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.
This commit is contained in:
parent
f19e3d501c
commit
0c070f7131
4 changed files with 23 additions and 15 deletions
|
@ -331,11 +331,11 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
* @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');
|
||||
}
|
||||
|
@ -425,8 +425,6 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
$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');
|
||||
|
|
|
@ -631,7 +631,7 @@ class ModelValidationTest extends BaseModelTest {
|
|||
|
||||
$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'])));
|
||||
|
|
|
@ -2737,7 +2737,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'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')
|
||||
|
@ -2990,15 +2990,25 @@ class ModelWriteTest extends BaseModelTest {
|
|||
* @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';
|
||||
|
@ -3489,7 +3499,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
), array('validate' => 'first'));
|
||||
|
||||
$this->assertEquals($result, array());
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $model->find('all');
|
||||
$this->assertEqual($result, array());
|
||||
|
|
|
@ -2265,7 +2265,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'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'),
|
||||
|
@ -5581,7 +5581,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
*/
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue