Refactored ConfigFile class so that it is no longer a singleton
[phpmyadmin.git] / test / engines / PMA_StorageEngine_innodb_test.php
blob8cef646dbbf5615a93a8d33c35e34ef33931bb3e
1 <?php
2 /**
3 * Tests for PMA_StorageEngine_innodb
5 * @package PhpMyAdmin-test
6 */
8 /*
9 * Include to test.
12 require_once 'libraries/StorageEngine.class.php';
13 require_once 'libraries/engines/innodb.lib.php';
14 require_once 'libraries/php-gettext/gettext.inc';
15 require_once 'libraries/Util.class.php';
16 require_once 'libraries/database_interface.inc.php';
17 require_once 'libraries/Tracker.class.php';
19 class PMA_StorageEngine_innodb_Test extends PHPUnit_Framework_TestCase
21 /**
22 * @access protected
24 protected $object;
26 /**
27 * Sets up the fixture, for example, opens a network connection.
28 * This method is called before a test is executed.
30 * @access protected
31 * @return void
33 protected function setUp()
35 $this->object = new PMA_StorageEngine_innodb('innodb');
38 /**
39 * Tears down the fixture, for example, closes a network connection.
40 * This method is called after a test is executed.
42 * @access protected
43 * @return void
45 protected function tearDown()
47 unset($this->object);
50 /**
51 * Test for getVariables
53 public function testGetVariables()
55 $this->assertEquals(
56 array(
57 'innodb_data_home_dir' => array(
58 'title' => __('Data home directory'),
59 'desc' => __('The common part of the directory path for all InnoDB data files.'),
61 'innodb_data_file_path' => array(
62 'title' => __('Data files'),
64 'innodb_autoextend_increment' => array(
65 'title' => __('Autoextend increment'),
66 'desc' => __('The increment size for extending the size of an autoextending tablespace when it becomes full.'),
67 'type' => 2,
69 'innodb_buffer_pool_size' => array(
70 'title' => __('Buffer pool size'),
71 'desc' => __('The size of the memory buffer InnoDB uses to cache data and indexes of its tables.'),
72 'type' => 1,
74 'innodb_additional_mem_pool_size' => array(
75 'title' => 'innodb_additional_mem_pool_size',
76 'type' => 1,
78 'innodb_buffer_pool_awe_mem_mb' => array(
79 'type' => 1,
81 'innodb_checksums' => array(
83 'innodb_commit_concurrency' => array(
85 'innodb_concurrency_tickets' => array(
86 'type' => 2,
88 'innodb_doublewrite' => array(
90 'innodb_fast_shutdown' => array(
92 'innodb_file_io_threads' => array(
93 'type' => 2,
95 'innodb_file_per_table' => array(
97 'innodb_flush_log_at_trx_commit' => array(
99 'innodb_flush_method' => array(
101 'innodb_force_recovery' => array(
103 'innodb_lock_wait_timeout' => array(
104 'type' => 2,
106 'innodb_locks_unsafe_for_binlog' => array(
108 'innodb_log_arch_dir' => array(
110 'innodb_log_archive' => array(
112 'innodb_log_buffer_size' => array(
113 'type' => 1,
115 'innodb_log_file_size' => array(
116 'type' => 1,
118 'innodb_log_files_in_group' => array(
119 'type' => 2,
121 'innodb_log_group_home_dir' => array(
123 'innodb_max_dirty_pages_pct' => array(
124 'type' => 2,
126 'innodb_max_purge_lag' => array(
128 'innodb_mirrored_log_groups' => array(
129 'type' => 2,
131 'innodb_open_files' => array(
132 'type' => 2,
134 'innodb_support_xa' => array(
136 'innodb_sync_spin_loops' => array(
137 'type' => 2,
139 'innodb_table_locks' => array(
140 'type' => 3,
142 'innodb_thread_concurrency' => array(
143 'type' => 2,
145 'innodb_thread_sleep_delay' => array(
146 'type' => 2,
149 $this->object->getVariables()
154 * Test for getVariablesLikePattern
156 public function testGetVariablesLikePattern()
158 $this->assertEquals(
159 'innodb\\_%',
160 $this->object->getVariablesLikePattern()
165 * Test for getInfoPages
167 public function testGetInfoPages()
169 $this->assertEquals(
170 array(),
171 $this->object->getInfoPages()
173 $this->object->support = 2;
174 $this->assertEquals(
175 array (
176 'Bufferpool' => 'Buffer Pool',
177 'Status' => 'InnoDB Status'
179 $this->object->getInfoPages()
184 * Test for getPageBufferpool
186 public function testGetPageBufferpool()
188 $this->assertEquals(
189 '<table class="data" id="table_innodb_bufferpool_usage">
190 <caption class="tblHeaders">
191 Buffer Pool Usage
192 </caption>
193 <tfoot>
194 <tr>
195 <th colspan="2">
196 Total
197 : 4,096&nbsp;pages / 65,536&nbsp;KiB
198 </th>
199 </tr>
200 </tfoot>
201 <tbody>
202 <tr class="odd">
203 <th>Free pages</th>
204 <td class="value">0</td>
205 </tr>
206 <tr class="even">
207 <th>Dirty pages</th>
208 <td class="value">0</td>
209 </tr>
210 <tr class="odd">
211 <th>Pages containing data</th>
212 <td class="value">0
213 </td>
214 </tr>
215 <tr class="even">
216 <th>Pages to be flushed</th>
217 <td class="value">0
218 </td>
219 </tr>
220 <tr class="odd">
221 <th>Busy pages</th>
222 <td class="value">0
223 </td>
224 </tr> </tbody>
225 </table>
227 <table class="data" id="table_innodb_bufferpool_activity">
228 <caption class="tblHeaders">
229 Buffer Pool Activity
230 </caption>
231 <tbody>
232 <tr class="odd">
233 <th>Read requests</th>
234 <td class="value">64
235 </td>
236 </tr>
237 <tr class="even">
238 <th>Write requests</th>
239 <td class="value">64
240 </td>
241 </tr>
242 <tr class="odd">
243 <th>Read misses</th>
244 <td class="value">32
245 </td>
246 </tr>
247 <tr class="even">
248 <th>Write waits</th>
249 <td class="value">0
250 </td>
251 </tr>
252 <tr class="odd">
253 <th>Read misses in %</th>
254 <td class="value">50 %
255 </td>
256 </tr>
257 <tr class="even">
258 <th>Write waits in %</th>
259 <td class="value">0 %
260 </td>
261 </tr>
262 </tbody>
263 </table>
265 $this->object->getPageBufferpool()
270 * Test for getPageStatus
272 public function testGetPageStatus()
274 $this->assertEquals(
275 '<pre id="pre_innodb_status">' . "\n" . "\n" . '</pre>' . "\n",
276 $this->object->getPageStatus()
282 * Test for getPage
284 public function testGetPage()
286 $this->assertFalse(
287 $this->object->getPage('Status')
289 $this->object->support = 2;
290 $this->assertEquals(
291 '<pre id="pre_innodb_status">' . "\n" . "\n" . '</pre>' . "\n",
292 $this->object->getPage('Status')
297 * Test for getMysqlHelpPage
299 public function testGetMysqlHelpPage()
301 $this->assertEquals(
302 'innodb-storage-engine',
303 $this->object->getMysqlHelpPage()
309 * Test for getInnodbPluginVersion
311 public function testGetInnodbPluginVersion()
313 $this->assertEquals(
314 '1.1.8',
315 $this->object->getInnodbPluginVersion()
321 * Test for supportsFilePerTable
323 public function testSupportsFilePerTable()
325 $this->assertFalse(
326 $this->object->supportsFilePerTable()
332 * Test for getInnodbFileFormat
334 public function testGetInnodbFileFormat()
336 $this->assertEquals(
337 'Antelope',
338 $this->object->getInnodbFileFormat()