1<?php 2 3 require_once __DIR__ . '/../Base.php'; 4 5/** 6 * 7 */ 8class Content_Test_Sql_Base extends Content_Test_Base 9{ 10 /** 11 * @static Horde_Db_Adapter_Base 12 */ 13 static $db; 14 15 /** 16 * @static Horde_Injector 17 */ 18 static $injector; 19 20 /** 21 * @static Horde_Db_Migration_Migrator 22 */ 23 static $migrator; 24 25 static $reason; 26 27 public function testCreate() 28 { 29 $this->_create(); 30 $objects = self::$db->selectAll('SELECT * FROM rampage_objects'); 31 $this->assertEquals(4, count($objects)); 32 // If these aren't strings, then ids were taken as names. 33 foreach ($objects as $object) { 34 $this->assertInternalType('string', $object['object_name']); 35 } 36 37 $types = self::$db->selectAll('SELECT * FROM rampage_types'); 38 $this->assertEquals(2, count($types)); 39 foreach ($types as $type) { 40 $this->assertInternalType('string', $type['type_name']); 41 } 42 } 43 44 /** 45 * @depends testCreate 46 */ 47 public function testEnsureTags() 48 { 49 $this->_testEnsureTags(); 50 } 51 52 public function testEnsureTypes() 53 { 54 $this->_testEnsureTypes(); 55 } 56 57 /** 58 * @depends testCreate 59 */ 60 public function testFullTagCloudSimple() 61 { 62 $this->_testFullTagCloudSimple(); 63 } 64 65 /** 66 * @depends testCreate 67 */ 68 public function testTagCloudByType() 69 { 70 $this->_testTagCloudByType(); 71 } 72 73 /** 74 * @depends testCreate 75 */ 76 public function testTagCloudByUser() 77 { 78 $this->_testTagCloudByUser(); 79 } 80 81 /** 82 * @depends testCreate 83 */ 84 public function testTagCloudByUserType() 85 { 86 $this->_testTagCloudByUserType(); 87 } 88 89 /** 90 * @depends testCreate 91 */ 92 public function testTagCloudByTagType() 93 { 94 $this->_testTagCloudByTagType(); 95 } 96 97 /** 98 * @depends testCreate 99 */ 100 public function testTagCloudByTagIds() 101 { 102 $this->_testTagCloudByTagIds(); 103 } 104 105 /** 106 * @depends testCreate 107 */ 108 public function testGetRecentTags() 109 { 110 $this->_testGetRecentTags(); 111 } 112 113 /** 114 * @depends testCreate 115 */ 116 public function testGetRecentTagsByUser() 117 { 118 $this->_testGetRecentTagsByUser(); 119 } 120 121 /** 122 * @depends testCreate 123 */ 124 public function testGetRecentObjects() 125 { 126 $this->_testGetRecentObjects(); 127 } 128 129 /** 130 * @depends testCreate 131 */ 132 public function testGetRecentTagsByType() 133 { 134 $this->_testGetRecentTagsByType(); 135 } 136 137 /** 138 * @depends testCreate 139 */ 140 public function testGetRecentObjectsByUser() 141 { 142 $this->_testGetRecentObjectsByUser(); 143 } 144 145 /** 146 * @depends testCreate 147 */ 148 public function testGetRecentObjectsByType() 149 { 150 $this->_testGetRecentObjectsByType(); 151 } 152 153 /** 154 * 155 * @depends testCreate 156 */ 157 public function testGetRecentUsers() 158 { 159 $this->_testGetRecentUsers(); 160 } 161 162 /** 163 * @depends testCreate 164 */ 165 public function testGetRecentUsersByType() 166 { 167 $this->_testGetRecentUsersByType(); 168 } 169 170 /** 171 * @depends testCreate 172 */ 173 public function testUntag() 174 { 175 $this->_testUntag(); 176 } 177 178 public static function setUpBeforeClass() 179 { 180 self::$injector = new Horde_Injector(new Horde_Injector_TopLevel()); 181 self::$injector->setInstance('Horde_Db_Adapter', self::$db); 182 183 // FIXME: get migration directory if not running from Git checkout. 184 self::$migrator = new Horde_Db_Migration_Migrator( 185 self::$db, 186 null, //$logger, 187 array('migrationsPath' => __DIR__ . '/../../../migration', 188 'schemaTableName' => 'content_test_schema')); 189 190 self::$migrator->up(); 191 self::$tagger = self::$injector->getInstance('Content_Tagger'); 192 self::$type_mgr = self::$injector->createInstance('Content_Types_Manager'); 193 } 194 195 public static function tearDownAfterClass() 196 { 197 if (self::$migrator) { 198 self::$migrator->down(); 199 } 200 self::$db = null; 201 parent::tearDownAfterClass(); 202 } 203 204 public function setUp() 205 { 206 if (!self::$db) { 207 $this->markTestSkipped(self::$reason); 208 } 209 } 210 211}