Skip to content

Commit

Permalink
Fixing whitespacing.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 19, 2009
1 parent 959befb commit ab21855
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions cake/tests/cases/libs/model/datasources/dbo_source.test.php
Expand Up @@ -4095,7 +4095,7 @@ function testVirtualFields() {
'this_moment' => 'NOW()',
'two' => '1 + 1',
'comment_count' => 'SELECT COUNT(*) FROM ' . $this->db->fullTableName('comments') .
' WHERE Article.id = ' . $this->db->fullTableName('comments'). '.article_id'
' WHERE Article.id = ' . $this->db->fullTableName('comments') . '.article_id'
);
$result = $this->db->fields($Article);
$expected = array(
Expand All @@ -4112,7 +4112,7 @@ function testVirtualFields() {
);
$this->assertEqual($expected,$result);

$result = $this->db->fields($Article,null,array('this_moment','title'));
$result = $this->db->fields($Article, null, array('this_moment','title'));
$expected = array(
'`Article`.`title`',
'(NOW()) AS `Article__this_moment`',
Expand All @@ -4133,27 +4133,27 @@ function testVirtualFieldsInConditions() {
'this_moment' => 'NOW()',
'two' => '1 + 1',
'comment_count' => 'SELECT COUNT(*) FROM ' . $this->db->fullTableName('comments') .
' WHERE Article.id = ' . $this->db->fullTableName('comments'). '.article_id'
' WHERE Article.id = ' . $this->db->fullTableName('comments') . '.article_id'
);
$conditions = array('two' => 2);
$result = $this->db->conditions($conditions,true,false,$Article);
$expected = '(1 + 1) = 2';
$this->assertEqual($expected,$result);
$this->assertEqual($expected, $result);

$conditions = array('this_moment BETWEEN ? AND ?' => array(1,2));
$expected = 'NOW() BETWEEN 1 AND 2';
$result = $this->db->conditions($conditions,true,false,$Article);
$this->assertEqual($expected,$result);
$result = $this->db->conditions($conditions, true, false, $Article);
$this->assertEqual($expected, $result);

$conditions = array('comment_count >' => 5);
$expected = '(SELECT COUNT(*) FROM comments WHERE `Article`.`id` = `comments`.`article_id`) > 5';
$result = $this->db->conditions($conditions,true,false,$Article);
$this->assertEqual($expected,$result);
$result = $this->db->conditions($conditions, true, false, $Article);
$this->assertEqual($expected, $result);

$conditions = array('NOT' => array('two' => 2));
$result = $this->db->conditions($conditions,true,false,$Article);
$result = $this->db->conditions($conditions, true, false, $Article);
$expected = 'NOT ((1 + 1) = 2)';
$this->assertEqual($expected,$result);
$this->assertEqual($expected, $result);
}

/**
Expand All @@ -4169,10 +4169,10 @@ function testVirtualFieldsInOrder() {
'this_moment' => 'NOW()',
'two' => '1 + 1',
);
$order = array('two','this_moment');
$result = $this->db->order($order,'ASC',$Article);
$order = array('two', 'this_moment');
$result = $this->db->order($order, 'ASC', $Article);
$expected = ' ORDER BY (1 + 1) ASC, (NOW()) ASC';
$this->assertEqual($expected,$result);
$this->assertEqual($expected, $result);
}

/**
Expand All @@ -4191,13 +4191,13 @@ function testVirtualFieldsInCalculate() {
' WHERE Article.id = ' . $this->db->fullTableName('comments'). '.article_id'
);

$result = $this->db->calculate($Article,'count',array('this_moment'));
$result = $this->db->calculate($Article, 'count', array('this_moment'));
$expected = 'COUNT(NOW()) AS `count`';
$this->assertEqual($expected,$result);
$this->assertEqual($expected, $result);

$result = $this->db->calculate($Article,'max',array('comment_count'));
$result = $this->db->calculate($Article, 'max', array('comment_count'));
$expected = 'MAX(SELECT COUNT(*) FROM comments WHERE `Article`.`id` = `comments`.`article_id`) AS `comment_count`';
$this->assertEqual($expected,$result);
$this->assertEqual($expected, $result);
}

/**
Expand Down

0 comments on commit ab21855

Please sign in to comment.