summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database/query_builder
diff options
context:
space:
mode:
authorGabriel Caruso <carusogabriel34@gmail.com>2017-12-08 20:25:02 +0100
committerGabriel Caruso <carusogabriel34@gmail.com>2017-12-20 17:43:45 +0100
commitdfa52f3ed31696c58fdc85273f4408559233b19e (patch)
tree63ca4ac93f9fd6f3afe5a91ef25701391ec9e593 /tests/codeigniter/database/query_builder
parent3ecfcaa94bbae55fec8c2c9bbf8524c49816342f (diff)
Refactoring tests
Diffstat (limited to 'tests/codeigniter/database/query_builder')
-rw-r--r--tests/codeigniter/database/query_builder/distinct_test.php4
-rw-r--r--tests/codeigniter/database/query_builder/empty_test.php4
-rw-r--r--tests/codeigniter/database/query_builder/escape_test.php6
-rw-r--r--tests/codeigniter/database/query_builder/from_test.php4
-rw-r--r--tests/codeigniter/database/query_builder/group_test.php12
-rw-r--r--tests/codeigniter/database/query_builder/like_test.php12
-rw-r--r--tests/codeigniter/database/query_builder/limit_test.php6
-rw-r--r--tests/codeigniter/database/query_builder/order_test.php6
-rw-r--r--tests/codeigniter/database/query_builder/select_test.php6
-rw-r--r--tests/codeigniter/database/query_builder/truncate_test.php6
-rw-r--r--tests/codeigniter/database/query_builder/where_test.php14
11 files changed, 40 insertions, 40 deletions
diff --git a/tests/codeigniter/database/query_builder/distinct_test.php b/tests/codeigniter/database/query_builder/distinct_test.php
index cc98009ce..81fabe448 100644
--- a/tests/codeigniter/database/query_builder/distinct_test.php
+++ b/tests/codeigniter/database/query_builder/distinct_test.php
@@ -27,7 +27,7 @@ class Distinct_test extends CI_TestCase {
->get('user')
->result_array();
- $this->assertEquals(3, count($users));
+ $this->assertCount(3, $users);
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/empty_test.php b/tests/codeigniter/database/query_builder/empty_test.php
index d1f56285f..3f63a60f5 100644
--- a/tests/codeigniter/database/query_builder/empty_test.php
+++ b/tests/codeigniter/database/query_builder/empty_test.php
@@ -25,7 +25,7 @@ class Empty_test extends CI_TestCase {
// Check initial record
$jobs = $this->db->get('job')->result_array();
- $this->assertEquals(4, count($jobs));
+ $this->assertCount(4, $jobs);
// Do the empty
$this->db->empty_table('job');
@@ -36,4 +36,4 @@ class Empty_test extends CI_TestCase {
$this->assertEmpty($jobs->result_array());
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/escape_test.php b/tests/codeigniter/database/query_builder/escape_test.php
index 27e678f22..de6cd0a9d 100644
--- a/tests/codeigniter/database/query_builder/escape_test.php
+++ b/tests/codeigniter/database/query_builder/escape_test.php
@@ -37,7 +37,7 @@ class Escape_test extends CI_TestCase {
$res = $this->db->query($sql)->result_array();
// Check the result
- $this->assertEquals(1, count($res));
+ $this->assertCount(1, $res);
}
// ------------------------------------------------------------------------
@@ -62,7 +62,7 @@ class Escape_test extends CI_TestCase {
$res = $this->db->query($sql)->result_array();
// Check the result
- $this->assertEquals(2, count($res));
+ $this->assertCount(2, $res);
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/from_test.php b/tests/codeigniter/database/query_builder/from_test.php
index 7aaae348d..5a4ac690d 100644
--- a/tests/codeigniter/database/query_builder/from_test.php
+++ b/tests/codeigniter/database/query_builder/from_test.php
@@ -26,7 +26,7 @@ class From_test extends CI_TestCase {
->get()
->result_array();
- $this->assertEquals(4, count($jobs));
+ $this->assertCount(4, $jobs);
}
// ------------------------------------------------------------------------
@@ -46,4 +46,4 @@ class From_test extends CI_TestCase {
$this->assertEquals('Awesome job, but sometimes makes you bored', $job1->description);
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/group_test.php b/tests/codeigniter/database/query_builder/group_test.php
index cf91c0965..df3f168c6 100644
--- a/tests/codeigniter/database/query_builder/group_test.php
+++ b/tests/codeigniter/database/query_builder/group_test.php
@@ -28,7 +28,7 @@ class Group_test extends CI_TestCase {
->get()
->result_array();
- $this->assertEquals(4, count($jobs));
+ $this->assertCount(4, $jobs);
}
// ------------------------------------------------------------------------
@@ -45,7 +45,7 @@ class Group_test extends CI_TestCase {
->get()
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
}
// ------------------------------------------------------------------------
@@ -62,7 +62,7 @@ class Group_test extends CI_TestCase {
->get()
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
}
// ------------------------------------------------------------------------
@@ -80,7 +80,7 @@ class Group_test extends CI_TestCase {
->get()
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
}
// ------------------------------------------------------------------------
@@ -97,7 +97,7 @@ class Group_test extends CI_TestCase {
->get()
->result_array();
- $this->assertEquals(3, count($jobs));
+ $this->assertCount(3, $jobs);
}
// ------------------------------------------------------------------------
@@ -115,6 +115,6 @@ class Group_test extends CI_TestCase {
->get()
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
}
}
diff --git a/tests/codeigniter/database/query_builder/like_test.php b/tests/codeigniter/database/query_builder/like_test.php
index 2736fbe0b..3672afae3 100644
--- a/tests/codeigniter/database/query_builder/like_test.php
+++ b/tests/codeigniter/database/query_builder/like_test.php
@@ -44,7 +44,7 @@ class Like_test extends CI_TestCase {
->result_array();
// Check the result
- $this->assertEquals(3, count($jobs));
+ $this->assertCount(3, $jobs);
$this->assertEquals('Developer', $jobs[0]['name']);
$this->assertEquals('Politician', $jobs[1]['name']);
$this->assertEquals('Musician', $jobs[2]['name']);
@@ -62,7 +62,7 @@ class Like_test extends CI_TestCase {
->result_array();
// Check the result
- $this->assertEquals(3, count($jobs));
+ $this->assertCount(3, $jobs);
$this->assertEquals('Politician', $jobs[0]['name']);
$this->assertEquals('Accountant', $jobs[1]['name']);
$this->assertEquals('Musician', $jobs[2]['name']);
@@ -81,7 +81,7 @@ class Like_test extends CI_TestCase {
->result_array();
// Check the result
- $this->assertEquals(3, count($jobs));
+ $this->assertCount(3, $jobs);
$this->assertEquals('Politician', $jobs[0]['name']);
$this->assertEquals('Accountant', $jobs[1]['name']);
$this->assertEquals('Musician', $jobs[2]['name']);
@@ -99,8 +99,8 @@ class Like_test extends CI_TestCase {
$spaces = $this->db->like('value', ' ')->get('misc')->result_array();
$tabs = $this->db->like('value', "\t")->get('misc')->result_array();
- $this->assertEquals(1, count($spaces));
- $this->assertEquals(1, count($tabs));
+ $this->assertCount(1, $spaces);
+ $this->assertCount(1, $tabs);
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/limit_test.php b/tests/codeigniter/database/query_builder/limit_test.php
index a0954c7ab..a1976d457 100644
--- a/tests/codeigniter/database/query_builder/limit_test.php
+++ b/tests/codeigniter/database/query_builder/limit_test.php
@@ -26,7 +26,7 @@ class Limit_test extends CI_TestCase {
->get('job')
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
}
// ------------------------------------------------------------------------
@@ -40,9 +40,9 @@ class Limit_test extends CI_TestCase {
->get('job')
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
$this->assertEquals('Accountant', $jobs[0]['name']);
$this->assertEquals('Musician', $jobs[1]['name']);
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/order_test.php b/tests/codeigniter/database/query_builder/order_test.php
index 46f452bae..ff5bc543d 100644
--- a/tests/codeigniter/database/query_builder/order_test.php
+++ b/tests/codeigniter/database/query_builder/order_test.php
@@ -27,7 +27,7 @@ class Order_test extends CI_TestCase {
->result_array();
// Check the result
- $this->assertEquals(4, count($jobs));
+ $this->assertCount(4, $jobs);
$this->assertEquals('Accountant', $jobs[0]['name']);
$this->assertEquals('Developer', $jobs[1]['name']);
$this->assertEquals('Musician', $jobs[2]['name']);
@@ -45,11 +45,11 @@ class Order_test extends CI_TestCase {
->get('job')
->result_array();
- $this->assertEquals(4, count($jobs));
+ $this->assertCount(4, $jobs);
$this->assertEquals('Politician', $jobs[0]['name']);
$this->assertEquals('Musician', $jobs[1]['name']);
$this->assertEquals('Developer', $jobs[2]['name']);
$this->assertEquals('Accountant', $jobs[3]['name']);
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/select_test.php b/tests/codeigniter/database/query_builder/select_test.php
index 877b5d8c0..93b5c3d46 100644
--- a/tests/codeigniter/database/query_builder/select_test.php
+++ b/tests/codeigniter/database/query_builder/select_test.php
@@ -28,8 +28,8 @@ class Select_test extends CI_TestCase {
// Check rows item
$this->assertArrayHasKey('name',$jobs_name[0]);
- $this->assertFalse(array_key_exists('id', $jobs_name[0]));
- $this->assertFalse(array_key_exists('description', $jobs_name[0]));
+ $this->assertArrayNotHasKey('id', $jobs_name[0]);
+ $this->assertArrayNotHasKey('description', $jobs_name[0]);
}
// ------------------------------------------------------------------------
@@ -92,4 +92,4 @@ class Select_test extends CI_TestCase {
$this->assertEquals('10', $job_sum->id);
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/truncate_test.php b/tests/codeigniter/database/query_builder/truncate_test.php
index 09923c7f1..64abe2872 100644
--- a/tests/codeigniter/database/query_builder/truncate_test.php
+++ b/tests/codeigniter/database/query_builder/truncate_test.php
@@ -24,7 +24,7 @@ class Truncate_test extends CI_TestCase {
{
// Check initial record
$jobs = $this->db->get('job')->result_array();
- $this->assertEquals(4, count($jobs));
+ $this->assertCount(4, $jobs);
// Do the empty
$this->db->truncate('job');
@@ -43,7 +43,7 @@ class Truncate_test extends CI_TestCase {
{
// Check initial record
$users = $this->db->get('user')->result_array();
- $this->assertEquals(4, count($users));
+ $this->assertCount(4, $users);
// Do the empty
$this->db->from('user')->truncate();
@@ -53,4 +53,4 @@ class Truncate_test extends CI_TestCase {
$this->assertEmpty($users->result_array());
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/database/query_builder/where_test.php b/tests/codeigniter/database/query_builder/where_test.php
index 46a7fa2eb..8a7a09ddb 100644
--- a/tests/codeigniter/database/query_builder/where_test.php
+++ b/tests/codeigniter/database/query_builder/where_test.php
@@ -36,7 +36,7 @@ class Where_test extends CI_TestCase {
public function test_where_custom_key_value()
{
$jobs = $this->db->where('id !=', 1)->get('job')->result_array();
- $this->assertEquals(3, count($jobs));
+ $this->assertCount(3, $jobs);
}
// ------------------------------------------------------------------------
@@ -49,7 +49,7 @@ class Where_test extends CI_TestCase {
$where = array('id >' => 2, 'name !=' => 'Accountant');
$jobs = $this->db->where($where)->get('job')->result_array();
- $this->assertEquals(1, count($jobs));
+ $this->assertCount(1, $jobs);
// Should be Musician
$job = current($jobs);
@@ -66,7 +66,7 @@ class Where_test extends CI_TestCase {
$where = "id > 2 AND name != 'Accountant'";
$jobs = $this->db->where($where)->get('job')->result_array();
- $this->assertEquals(1, count($jobs));
+ $this->assertCount(1, $jobs);
// Should be Musician
$job = current($jobs);
@@ -85,7 +85,7 @@ class Where_test extends CI_TestCase {
->get('job')
->result_array();
- $this->assertEquals(3, count($jobs));
+ $this->assertCount(3, $jobs);
$this->assertEquals('Developer', $jobs[0]['name']);
$this->assertEquals('Politician', $jobs[1]['name']);
$this->assertEquals('Musician', $jobs[2]['name']);
@@ -102,7 +102,7 @@ class Where_test extends CI_TestCase {
->get('job')
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
$this->assertEquals('Politician', $jobs[0]['name']);
$this->assertEquals('Accountant', $jobs[1]['name']);
}
@@ -118,7 +118,7 @@ class Where_test extends CI_TestCase {
->get('job')
->result_array();
- $this->assertEquals(2, count($jobs));
+ $this->assertCount(2, $jobs);
$this->assertEquals('Developer', $jobs[0]['name']);
$this->assertEquals('Musician', $jobs[1]['name']);
}
@@ -131,4 +131,4 @@ class Where_test extends CI_TestCase {
$sql = $this->db->where('foo', $input)->get_compiled_select('dummy');
$this->assertEquals("'".$input."'", substr($sql, -20));
}
-} \ No newline at end of file
+}