Skip to content
Permalink
Browse files

closing more cursors in tests

  • Loading branch information...
lorenzo committed Mar 26, 2016
1 parent ff1aaef commit 6e4a05faf2c8c10e133557a9b6acb258da6c228c
Showing with 38 additions and 0 deletions.
  1. +38 −0 tests/TestCase/Database/QueryTest.php
@@ -411,6 +411,7 @@ public function testSelectJoinWithCallback()
})
->execute();
$this->assertCount(0, $result->fetchAll());
$result->closeCursor();
$query = new Query($this->connection);
$types = ['created' => 'datetime'];
@@ -427,6 +428,7 @@ public function testSelectJoinWithCallback()
['title' => 'First Article', 'name' => 'Second Comment for First Article'],
$result->fetch('assoc')
);
$result->closeCursor();
}
/**
@@ -586,6 +588,7 @@ public function testSelectWhereTypes()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -596,6 +599,7 @@ public function testSelectWhereTypes()
$this->assertCount(5, $result);
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
$this->assertEquals(['id' => 3], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -611,6 +615,7 @@ public function testSelectWhereTypes()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -626,6 +631,7 @@ public function testSelectWhereTypes()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 3], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -641,6 +647,7 @@ public function testSelectWhereTypes()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -660,6 +667,7 @@ public function testSelectWhereArrayType()
$this->assertCount(2, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$this->assertEquals(['id' => 3], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -715,6 +723,7 @@ public function testSelectOrWhere()
$this->assertCount(2, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -733,6 +742,7 @@ public function testSelectAndWhere()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -742,6 +752,7 @@ public function testSelectAndWhere()
->andWhere(['id' => 2])
->execute();
$this->assertCount(0, $result);
$result->closeCursor();
}
/**
@@ -763,6 +774,7 @@ public function testSelectExpressionNesting()
$this->assertCount(2, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -777,6 +789,7 @@ public function testSelectExpressionNesting()
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
$this->assertEquals(['id' => 3], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -796,6 +809,7 @@ public function testSelectOrWhereNoPreviousCondition()
$this->assertCount(2, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -814,6 +828,7 @@ public function testSelectAndWhereNoPreviousCondition()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -834,6 +849,7 @@ public function testSelectWhereUsingClosure()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -847,6 +863,7 @@ public function testSelectWhereUsingClosure()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -859,6 +876,7 @@ public function testSelectWhereUsingClosure()
})
->execute();
$this->assertCount(0, $result);
$result->closeCursor();
}
/**
@@ -907,6 +925,7 @@ public function testSelectAndWhereUsingClosure()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -918,6 +937,7 @@ public function testSelectAndWhereUsingClosure()
})
->execute();
$this->assertCount(0, $result);
$result->closeCursor();
}
/**
@@ -940,6 +960,7 @@ public function testSelectOrWhereUsingClosure()
$this->assertCount(2, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -954,6 +975,7 @@ public function testSelectOrWhereUsingClosure()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -976,6 +998,7 @@ public function testSelectWhereUsingExpressionInField()
})
->execute();
$this->assertCount(0, $result);
$result->closeCursor();
}
/**
@@ -995,6 +1018,7 @@ public function testSelectWhereOperatorMethods()
->execute();
$this->assertCount(2, $result);
$this->assertEquals(['title' => 'Second Article'], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query->select(['title'])
@@ -1005,6 +1029,7 @@ public function testSelectWhereOperatorMethods()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['title' => 'First Article'], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query->select(['title'])
@@ -1014,6 +1039,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(2, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1024,6 +1050,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(3, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1034,6 +1061,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(1, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1045,6 +1073,7 @@ public function testSelectWhereOperatorMethods()
->execute();
$this->assertCount(2, $result);
$this->assertEquals(['title' => 'First Article'], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1056,6 +1085,7 @@ public function testSelectWhereOperatorMethods()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['title' => 'First Article'], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1066,6 +1096,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(3, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1076,6 +1107,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(0, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1086,6 +1118,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(0, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1096,6 +1129,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(6, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1106,6 +1140,7 @@ public function testSelectWhereOperatorMethods()
})
->execute();
$this->assertCount(6, $result);
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1122,6 +1157,7 @@ public function testSelectWhereOperatorMethods()
$this->assertCount(2, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query
@@ -1137,6 +1173,7 @@ public function testSelectWhereOperatorMethods()
->execute();
$this->assertCount(4, $result);
$this->assertEquals(['id' => 3], $result->fetch('assoc'));
$result->closeCursor();
}
/**
@@ -1156,6 +1193,7 @@ public function testInValueCast()
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
$result->closeCursor();
$query = new Query($this->connection);
$result = $query

0 comments on commit 6e4a05f

Please sign in to comment.
You can’t perform that action at this time.