aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2012-03-04 01:59:40 +0100
committerAndreas Fischer <bantu@phpbb.com>2012-03-04 01:59:40 +0100
commit6df721b21528e4d9881fa191159b123bb2b6b33f (patch)
treee66ef8b7650bbd56cc7b1e2eb3b98fa1af2b90a2 /tests/dbal
parentf9953fc3395e6b206c0789d40f89f9d2463348e7 (diff)
downloadforums-6df721b21528e4d9881fa191159b123bb2b6b33f.tar
forums-6df721b21528e4d9881fa191159b123bb2b6b33f.tar.gz
forums-6df721b21528e4d9881fa191159b123bb2b6b33f.tar.bz2
forums-6df721b21528e4d9881fa191159b123bb2b6b33f.tar.xz
forums-6df721b21528e4d9881fa191159b123bb2b6b33f.zip
[ticket/10653] Unit tests for get_row_count() and get_estimated_row_count().
PHPBB3-10653
Diffstat (limited to 'tests/dbal')
-rw-r--r--tests/dbal/select_test.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php
index 05b0e68e29..9d46b47b17 100644
--- a/tests/dbal/select_test.php
+++ b/tests/dbal/select_test.php
@@ -357,4 +357,29 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$this->assertSame(false, $row);
}
+
+ public function test_get_row_count()
+ {
+ $this->assertSame(
+ 3,
+ (int) $this->new_dbal()->get_row_count('phpbb_users'),
+ "Failed asserting that user table has exactly 3 rows."
+ );
+ }
+
+ public function test_get_estimated_row_count()
+ {
+ $actual = $this->new_dbal()->get_estimated_row_count('phpbb_users');
+
+ if (is_string($actual) && isset($actual[0]) && $actual[0] === '~')
+ {
+ $actual = substr($actual, -1);
+ }
+
+ $this->assertGreaterThan(
+ 1,
+ $actual,
+ "Failed asserting that estimated row count of user table is greater than 1."
+ );
+ }
}