Fixing failing tests caused by merge with 1.3

This commit is contained in:
mark_story 2011-10-06 21:23:35 -04:00
parent 055224ef68
commit d9e51acf0a
3 changed files with 21 additions and 26 deletions

View file

@ -715,7 +715,6 @@ class PaginatorComponentTest extends CakeTestCase {
$Controller->uses = array('PaginatorControllerPost', 'ControllerComment'); $Controller->uses = array('PaginatorControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1'; $Controller->passedArgs[] = '1';
$Controller->params['url'] = array();
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->request->params['named'] = array( $Controller->request->params['named'] = array(
@ -750,28 +749,27 @@ class PaginatorComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPaginateOrderVirtualFieldSharedWithRealField() { function testPaginateOrderVirtualFieldSharedWithRealField() {
$Controller =& new Controller(); $Controller =& new Controller($this->request);
$Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->uses = array('PaginatorControllerPost', 'PaginatorControllerComment');
$Controller->request->params['url'] = array();
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->ControllerComment->virtualFields = array( $Controller->PaginatorControllerComment->virtualFields = array(
'title' => 'ControllerComment.comment' 'title' => 'PaginatorControllerComment.comment'
); );
$Controller->ControllerComment->bindModel(array( $Controller->PaginatorControllerComment->bindModel(array(
'belongsTo' => array( 'belongsTo' => array(
'ControllerPost' => array( 'PaginatorControllerPost' => array(
'className' => 'ControllerPost', 'className' => 'PaginatorControllerPost',
'foreignKey' => 'article_id' 'foreignKey' => 'article_id'
) )
) )
), false); ), false);
$Controller->paginate = array( $Controller->paginate = array(
'fields' => array('ControllerComment.id', 'title', 'ControllerPost.title'), 'fields' => array('PaginatorControllerComment.id', 'title', 'PaginatorControllerPost.title'),
); );
$Controller->passedArgs = array('sort' => 'ControllerPost.title', 'dir' => 'asc'); $Controller->passedArgs = array('sort' => 'PaginatorControllerPost.title', 'dir' => 'asc');
$result = $Controller->paginate('ControllerComment'); $result = $Controller->paginate('PaginatorControllerComment');
$this->assertEqual(Set::extract($result, '{n}.ControllerComment.id'), array(1, 2, 3, 4, 5, 6)); $this->assertEqual(Set::extract($result, '{n}.PaginatorControllerComment.id'), array(1, 2, 3, 4, 5, 6));
} }
} }

View file

@ -149,29 +149,26 @@ class MysqlTest extends CakeTestCase {
$restore = setlocale(LC_ALL, null); $restore = setlocale(LC_ALL, null);
setlocale(LC_ALL, 'de_DE'); setlocale(LC_ALL, 'de_DE');
$result = $this->Dbo->value(3.141593, 'float');
$this->assertTrue(strpos((string)$result, ',') === false);
$result = $this->Dbo->value(3.141593); $result = $this->Dbo->value(3.141593);
$this->assertTrue(strpos((string)$result, ',') === false); $this->assertEquals('3.141593', $result);
$result = $this->db->value(3.141593); $result = $this->db->value(3.141593, 'float');
$this->assertEqual('3.141593', $result); $this->assertEquals('3.141593', $result);
$result = $this->db->value(1234567.11, 'float'); $result = $this->db->value(1234567.11, 'float');
$this->assertEqual('1234567.11', $result); $this->assertEquals('1234567.11', $result);
$result = $this->db->value(123456.45464748, 'float'); $result = $this->db->value(123456.45464748, 'float');
$this->assertEqual('123456.454647', $result); $this->assertEquals('123456.454647', $result);
$result = $this->db->value(0.987654321, 'float'); $result = $this->db->value(0.987654321, 'float');
$this->assertEqual('0.987654321', (string)$result); $this->assertEquals('0.987654321', (string)$result);
$result = $this->db->value(2.2E-54, 'float'); $result = $this->db->value(2.2E-54, 'float');
$this->assertEqual('2.2E-54', (string)$result); $this->assertEquals('2.2E-54', (string)$result);
$result = $this->db->value(2.2E-54); $result = $this->db->value(2.2E-54);
$this->assertEqual('2.2E-54', (string)$result); $this->assertEquals('2.2E-54', (string)$result);
setlocale(LC_ALL, $restore); setlocale(LC_ALL, $restore);
} }

View file

@ -347,10 +347,10 @@ class PostgresTest extends CakeTestCase {
setlocale(LC_ALL, 'de_DE'); setlocale(LC_ALL, 'de_DE');
$result = $this->db->value(3.141593, 'float'); $result = $this->db->value(3.141593, 'float');
$this->assertEqual((string)$result, "3.14159"); $this->assertEquals($result, "3.141593");
$result = $this->db->value(3.14); $result = $this->db->value(3.14);
$this->assertEqual((string)$result, "3.140000"); $this->assertEquals($result, "3.140000");
setlocale(LC_ALL, $restore); setlocale(LC_ALL, $restore);
} }