summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database/query_builder
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-04-05 16:47:53 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-04-05 16:47:53 +0200
commit0793b1c918a0146920b1a03323f055521c4a9c66 (patch)
treef7bb5476652a92b2501f6fe0342635be0d81aa30 /tests/codeigniter/database/query_builder
parent611a7ac596d5b37086a4f975a1b52664cdfb0de7 (diff)
Rename to db, for more familiar naming convention
Diffstat (limited to 'tests/codeigniter/database/query_builder')
-rw-r--r--tests/codeigniter/database/query_builder/get_test.php10
-rw-r--r--tests/codeigniter/database/query_builder/select_test.php36
2 files changed, 21 insertions, 25 deletions
diff --git a/tests/codeigniter/database/query_builder/get_test.php b/tests/codeigniter/database/query_builder/get_test.php
index dd946a40c..0751c9332 100644
--- a/tests/codeigniter/database/query_builder/get_test.php
+++ b/tests/codeigniter/database/query_builder/get_test.php
@@ -5,16 +5,14 @@ class Get_test extends CI_TestCase {
/**
* @var object Database/Query Builder holder
*/
- protected $query_builder;
+ protected $db;
public function set_up()
{
- $db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+ $this->db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
Mock_Database_Schema_Skeleton::create_tables();
Mock_Database_Schema_Skeleton::create_data();
-
- $this->query_builder = $db;
}
// ------------------------------------------------------------------------
@@ -24,7 +22,7 @@ class Get_test extends CI_TestCase {
*/
public function test_get_simple()
{
- $jobs = $this->query_builder->get('job')->result_array();
+ $jobs = $this->db->get('job')->result_array();
// Dummy jobs contain 4 rows
$this->assertCount(4, $jobs);
@@ -43,7 +41,7 @@ class Get_test extends CI_TestCase {
*/
public function test_get_where()
{
- $job1 = $this->query_builder->get('job', array('id' => 1))->result_array();
+ $job1 = $this->db->get('job', array('id' => 1))->result_array();
// Dummy jobs contain 1 rows
$this->assertCount(1, $job1);
diff --git a/tests/codeigniter/database/query_builder/select_test.php b/tests/codeigniter/database/query_builder/select_test.php
index 50a062c9f..dbf432a7c 100644
--- a/tests/codeigniter/database/query_builder/select_test.php
+++ b/tests/codeigniter/database/query_builder/select_test.php
@@ -5,16 +5,14 @@ class Select_test extends CI_TestCase {
/**
* @var object Database/Query Builder holder
*/
- protected $query_builder;
+ protected $db;
public function set_up()
{
- $db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
+ $this->db = Mock_Database_Schema_Skeleton::init(DB_DRIVER);
Mock_Database_Schema_Skeleton::create_tables();
Mock_Database_Schema_Skeleton::create_data();
-
- $this->query_builder = $db;
}
// ------------------------------------------------------------------------
@@ -24,9 +22,9 @@ class Select_test extends CI_TestCase {
*/
public function test_select_only_one_collumn()
{
- $jobs_name = $this->query_builder->select('name')
- ->get('job')
- ->result_array();
+ $jobs_name = $this->db->select('name')
+ ->get('job')
+ ->result_array();
// Check rows item
$this->assertArrayHasKey('name',$jobs_name[0]);
@@ -41,9 +39,9 @@ class Select_test extends CI_TestCase {
*/
public function test_select_min()
{
- $job_min = $this->query_builder->select_min('id')
- ->get('job')
- ->result_array();
+ $job_min = $this->db->select_min('id')
+ ->get('job')
+ ->result_array();
// Minimum id was 1
$this->assertEquals('1', $job_min[0]['id']);
@@ -56,9 +54,9 @@ class Select_test extends CI_TestCase {
*/
public function test_select_max()
{
- $job_max = $this->query_builder->select_max('id')
- ->get('job')
- ->result_array();
+ $job_max = $this->db->select_max('id')
+ ->get('job')
+ ->result_array();
// Maximum id was 4
$this->assertEquals('4', $job_max[0]['id']);
@@ -71,9 +69,9 @@ class Select_test extends CI_TestCase {
*/
public function test_select_avg()
{
- $job_avg = $this->query_builder->select_avg('id')
- ->get('job')
- ->result_array();
+ $job_avg = $this->db->select_avg('id')
+ ->get('job')
+ ->result_array();
// Average should be 2.5
$this->assertEquals('2.5', $job_avg[0]['id']);
@@ -86,9 +84,9 @@ class Select_test extends CI_TestCase {
*/
public function test_select_sum()
{
- $job_sum = $this->query_builder->select_sum('id')
- ->get('job')
- ->result_array();
+ $job_sum = $this->db->select_sum('id')
+ ->get('job')
+ ->result_array();
// Sum of ids should be 10
$this->assertEquals('10', $job_sum[0]['id']);