Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php |
— | — | @@ -69,6 +69,10 @@ |
70 | 70 | $this->destroyDB(); |
71 | 71 | } |
72 | 72 | } |
| 73 | + |
| 74 | + function dbPrefix() { |
| 75 | + return $this->db->getType() == 'oracle' ? self::ORA_DB_PREFIX : self::DB_PREFIX; |
| 76 | + } |
73 | 77 | |
74 | 78 | function needsDB() { |
75 | 79 | $rc = new ReflectionClass( $this ); |
— | — | @@ -112,15 +116,13 @@ |
113 | 117 | |
114 | 118 | $dbType = $this->db->getType(); |
115 | 119 | |
116 | | - if ( $wgDBprefix === self::DB_PREFIX || ( $dbType == 'oracle' && $wgDBprefix === self::ORA_DB_PREFIX ) ) { |
| 120 | + if ( $wgDBprefix === $this->dbPrefix() ) { |
117 | 121 | throw new MWException( 'Cannot run unit tests, the database prefix is already "unittest_"' ); |
118 | 122 | } |
119 | 123 | |
120 | 124 | $tables = $this->listTables(); |
121 | 125 | |
122 | | - $prefix = $dbType != 'oracle' ? self::DB_PREFIX : self::ORA_DB_PREFIX; |
123 | | - |
124 | | - $this->dbClone = new CloneDatabase( $this->db, $tables, $prefix ); |
| 126 | + $this->dbClone = new CloneDatabase( $this->db, $tables, $this->dbPrefix() ); |
125 | 127 | $this->dbClone->useTemporaryTables( $this->useTemporaryTables ); |
126 | 128 | $this->dbClone->cloneTableStructure(); |
127 | 129 | |
— | — | @@ -150,12 +152,7 @@ |
151 | 153 | return; |
152 | 154 | } |
153 | 155 | |
154 | | - if( $this->db->getType() == 'oracle' ) { |
155 | | - $tables = $this->db->listTables( self::ORA_DB_PREFIX, __METHOD__ ); |
156 | | - } |
157 | | - else { |
158 | | - $tables = $this->db->listTables( self::DB_PREFIX, __METHOD__ ); |
159 | | - } |
| 156 | + $tables = $this->db->listTables( $this->dbPrefix(), __METHOD__ ); |
160 | 157 | |
161 | 158 | foreach ( $tables as $table ) { |
162 | 159 | try { |