Permalink
Browse files

Updating the test to be compatible with others dbo drivers.

  • Loading branch information...
1 parent 7bae41c commit 0ae9974b3f1ae8de5a2986d4a2d879bb7d56970b @jrbasso jrbasso committed May 23, 2011
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -415,7 +415,12 @@ public function testCounterCacheWithSelfJoin() {
}
$this->loadFixtures('CategoryThread');
- $this->db->query('ALTER TABLE '. $this->db->fullTableName('category_threads') . " ADD COLUMN child_count INTEGER");
+ $column = 'COLUMN ';
+ if ($this->db instanceof Sqlserver) {
+ $column = '';
+ }
+ $column .= $this->db->buildColumn(array('name' => 'child_count', 'type' => 'integer'));
+ $this->db->query('ALTER TABLE '. $this->db->fullTableName('category_threads') . ' ADD ' . $column);
$Category = new CategoryThread();
$result = $Category->updateAll(array('CategoryThread.name' => "'updated'"), array('CategoryThread.parent_id' => 5));
$this->assertFalse(empty($result));
@@ -424,7 +429,7 @@ public function testCounterCacheWithSelfJoin() {
$Category->belongsTo['ParentCategory']['counterCache'] = 'child_count';
$Category->updateCounterCache(array('parent_id' => 5));
$result = Set::extract($Category->find('all', array('conditions' => array('CategoryThread.id' => 5))), '{n}.CategoryThread.child_count');
- $expected = array_fill(0, 1, 1);
+ $expected = array(1);
$this->assertEqual($expected, $result);
}

0 comments on commit 0ae9974

Please sign in to comment.