Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 70 lines (64 sloc) 2.439 kB
7787839 Warn user of slow web migration
Mark Wilkie authored
1 <?php
2 /**
3 *
4 * ThinkUp/tests/TestOfTableStatsMySQLDAO.php
5 *
aa08b69 @ginatrapani Update copyright notice to 2012
ginatrapani authored
6 * Copyright (c) 2009-2012 Mark Wilkie
7787839 Warn user of slow web migration
Mark Wilkie authored
7 *
8 * LICENSE:
9 *
10 * This file is part of ThinkUp (http://thinkupapp.com).
11 *
12 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
13 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
14 * later version.
15 *
16 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
17 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * details.
19 *
20 * You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
21 * <http://www.gnu.org/licenses/>.
22 *
23 *
24 * @author Mark Wilkie <mark[at]bitterpill[dot]org>
25 * @license http://www.gnu.org/licenses/gpl.html
aa08b69 @ginatrapani Update copyright notice to 2012
ginatrapani authored
26 * @copyright 2009-2012 Mark Wilkie
7787839 Warn user of slow web migration
Mark Wilkie authored
27 */
28 require_once dirname(__FILE__).'/init.tests.php';
29 require_once THINKUP_ROOT_PATH.'webapp/_lib/extlib/simpletest/autorun.php';
30 require_once THINKUP_ROOT_PATH.'webapp/config.inc.php';
31
32 class TestOfTableStatsMySQLDAO extends ThinkUpUnitTestCase {
33
34 public function setUp() {
35 parent::setUp();
36 $this->logger = Logger::getInstance();
37 $this->config = Config::getInstance();
38 $optiondao = new OptionMySQLDAO();
39 $this->pdo = $optiondao->connect();
40 }
41
42 public function tearDown() {
43 parent::tearDown();
44 $this->logger->close();
45 }
46
47 public function testDAOFactory() {
48 $this->assertIsA(DAOFactory::getDAO('TableStatsDAO'), 'TableStatsMySQLDAO');
49 }
50
51 public function testGetCounts() {
52 $table_stats_daa = new TableStatsMySQLDAO();
53 // no counts...
54 $counts = $table_stats_daa->getTableRowCounts();
55 foreach($counts as $table) {
56 if($table['table'] == $this->table_prefix . 'options') {
57 $this->assertEqual($table['count'], 1);
58 } else if($table['table'] == $this->table_prefix . 'plugins') {
ef365e4 @ginatrapani Activate Google+ plugin by default
ginatrapani authored
59 $this->assertEqual($table['count'], 4);
7787839 Warn user of slow web migration
Mark Wilkie authored
60 } else {
61 $this->assertEqual($table['count'], 0);
62 }
63 }
64
65 // are we sorted by count desc?
ef365e4 @ginatrapani Activate Google+ plugin by default
ginatrapani authored
66 $this->assertEqual(4,$counts[0]['count']);
7787839 Warn user of slow web migration
Mark Wilkie authored
67 $this->assertEqual(1,$counts[1]['count']);
68 $this->assertEqual(0,$counts[2]['count']);
69 }
70 }
Something went wrong with that request. Please try again.