File: Base.php

package info (click to toggle)
php-horde-content 2.0.4-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 308 kB
  • ctags: 377
  • sloc: php: 1,454; xml: 474; makefile: 10; sh: 3
file content (211 lines) | stat: -rw-r--r-- 4,366 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?php

 require_once __DIR__ . '/../Base.php';

/**
 *
 */
class Content_Test_Sql_Base extends Content_Test_Base
{
    /**
     * @static Horde_Db_Adapter_Base
     */
    static $db;

    /**
     * @static Horde_Injector
     */
    static $injector;

    /**
     * @static Horde_Db_Migration_Migrator
     */
    static $migrator;

    static $reason;

    public function testCreate()
    {
        $this->_create();
        $objects = self::$db->selectAll('SELECT * FROM rampage_objects');
        $this->assertEquals(4, count($objects));
        // If these aren't strings, then ids were taken as names.
        foreach ($objects as $object) {
            $this->assertInternalType('string', $object['object_name']);
        }

        $types = self::$db->selectAll('SELECT * FROM rampage_types');
        $this->assertEquals(2, count($types));
        foreach ($types as $type) {
            $this->assertInternalType('string', $type['type_name']);
        }
    }

    /**
     * @depends testCreate
     */
    public function testEnsureTags()
    {
        $this->_testEnsureTags();
    }

    public function testEnsureTypes()
    {
        $this->_testEnsureTypes();
    }

    /**
     * @depends testCreate
     */
    public function testFullTagCloudSimple()
    {
        $this->_testFullTagCloudSimple();
    }

    /**
     * @depends testCreate
     */
    public function testTagCloudByType()
    {
        $this->_testTagCloudByType();
    }

    /**
     * @depends testCreate
     */
     public function testTagCloudByUser()
     {
         $this->_testTagCloudByUser();
     }

     /**
      * @depends testCreate
      */
     public function testTagCloudByUserType()
     {
         $this->_testTagCloudByUserType();
     }

     /**
      * @depends testCreate
      */
     public function testTagCloudByTagType()
     {
         $this->_testTagCloudByTagType();
     }

     /**
      * @depends testCreate
      */
     public function testTagCloudByTagIds()
     {
         $this->_testTagCloudByTagIds();
     }

    /**
     * @depends testCreate
     */
    public function testGetRecentTags()
    {
        $this->_testGetRecentTags();
    }

    /**
     * @depends testCreate
     */
    public function testGetRecentTagsByUser()
    {
        $this->_testGetRecentTagsByUser();
    }

    /**
     * @depends testCreate
     */
    public function testGetRecentObjects()
    {
        $this->_testGetRecentObjects();
    }

    /**
     * @depends testCreate
     */
    public function testGetRecentTagsByType()
    {
        $this->_testGetRecentTagsByType();
    }

    /**
     * @depends testCreate
     */
    public function testGetRecentObjectsByUser()
    {
        $this->_testGetRecentObjectsByUser();
    }

    /**
     * @depends testCreate
     */
    public function testGetRecentObjectsByType()
    {
        $this->_testGetRecentObjectsByType();
    }

    /**
     *
     * @depends testCreate
     */
    public function testGetRecentUsers()
    {
        $this->_testGetRecentUsers();
    }

    /**
     * @depends testCreate
     */
    public function testGetRecentUsersByType()
    {
        $this->_testGetRecentUsersByType();
    }

    /**
     * @depends testCreate
     */
    public function testUntag()
    {
        $this->_testUntag();
    }

    public static function setUpBeforeClass()
    {
        self::$injector = new Horde_Injector(new Horde_Injector_TopLevel());
        self::$injector->setInstance('Horde_Db_Adapter', self::$db);

        // FIXME: get migration directory if not running from Git checkout.
        self::$migrator = new Horde_Db_Migration_Migrator(
            self::$db,
            null, //$logger,
            array('migrationsPath' => __DIR__ . '/../../../migration',
                  'schemaTableName' => 'content_test_schema'));

        self::$migrator->up();
        self::$tagger = self::$injector->getInstance('Content_Tagger');
        self::$type_mgr = self::$injector->createInstance('Content_Types_Manager');
    }

    public static function tearDownAfterClass()
    {
        if (self::$migrator) {
            self::$migrator->down();
        }
        self::$db = null;
        parent::tearDownAfterClass();
    }

    public function setUp()
    {
        if (!self::$db) {
            $this->markTestSkipped(self::$reason);
        }
    }

}