3 declare(strict_types
=1);
5 namespace PhpMyAdmin\Tests\Engines
;
7 use PhpMyAdmin\Dbal\DatabaseInterface
;
8 use PhpMyAdmin\Engines\Innodb
;
9 use PhpMyAdmin\Tests\AbstractTestCase
;
10 use PHPUnit\Framework\Attributes\CoversClass
;
14 #[CoversClass(Innodb::class)]
15 class InnodbTest
extends AbstractTestCase
17 protected Innodb
$object;
20 * Sets up the fixture, for example, opens a network connection.
21 * This method is called before a test is executed.
23 protected function setUp(): void
27 DatabaseInterface
::$instance = $this->createDatabaseInterface();
28 $this->object = new Innodb('innodb');
32 * Tears down the fixture, for example, closes a network connection.
33 * This method is called after a test is executed.
35 protected function tearDown(): void
43 * Test for getVariables
45 public function testGetVariables(): void
49 'innodb_data_home_dir' => [
50 'title' => __('Data home directory'),
51 'desc' => __('The common part of the directory path for all InnoDB data files.'),
53 'innodb_data_file_path' => ['title' => __('Data files')],
54 'innodb_autoextend_increment' => [
55 'title' => __('Autoextend increment'),
57 'The increment size for extending the size of'
58 . ' an autoextending tablespace when it becomes full.',
62 'innodb_buffer_pool_size' => [
63 'title' => __('Buffer pool size'),
64 'desc' => __('The size of the memory buffer InnoDB uses to cache data and indexes of its tables.'),
67 'innodb_additional_mem_pool_size' => ['title' => 'innodb_additional_mem_pool_size', 'type' => 1],
68 'innodb_buffer_pool_awe_mem_mb' => ['type' => 1],
69 'innodb_checksums' => [],
70 'innodb_commit_concurrency' => [],
71 'innodb_concurrency_tickets' => ['type' => 2],
72 'innodb_doublewrite' => [],
73 'innodb_fast_shutdown' => [],
74 'innodb_file_io_threads' => ['type' => 2],
75 'innodb_file_per_table' => [],
76 'innodb_flush_log_at_trx_commit' => [],
77 'innodb_flush_method' => [],
78 'innodb_force_recovery' => [],
79 'innodb_lock_wait_timeout' => ['type' => 2],
80 'innodb_locks_unsafe_for_binlog' => [],
81 'innodb_log_arch_dir' => [],
82 'innodb_log_archive' => [],
83 'innodb_log_buffer_size' => ['type' => 1],
84 'innodb_log_file_size' => ['type' => 1],
85 'innodb_log_files_in_group' => ['type' => 2],
86 'innodb_log_group_home_dir' => [],
87 'innodb_max_dirty_pages_pct' => ['type' => 2],
88 'innodb_max_purge_lag' => [],
89 'innodb_mirrored_log_groups' => ['type' => 2],
90 'innodb_open_files' => ['type' => 2],
91 'innodb_support_xa' => [],
92 'innodb_sync_spin_loops' => ['type' => 2],
93 'innodb_table_locks' => ['type' => 3],
94 'innodb_thread_concurrency' => ['type' => 2],
95 'innodb_thread_sleep_delay' => ['type' => 2],
97 $this->object->getVariables(),
102 * Test for getVariablesLikePattern
104 public function testGetVariablesLikePattern(): void
108 $this->object->getVariablesLikePattern(),
113 * Test for getInfoPages
115 public function testGetInfoPages(): void
119 $this->object->getInfoPages(),
121 $this->object->support
= 2;
123 ['Bufferpool' => 'Buffer Pool', 'Status' => 'InnoDB Status'],
124 $this->object->getInfoPages(),
129 * Test for getPageBufferpool
131 public function testGetPageBufferpool(): void
134 '<table class="table table-striped table-hover w-auto float-start caption-top">' . "\n" .
135 ' <caption>' . "\n" .
136 ' Buffer Pool Usage' . "\n" .
137 ' </caption>' . "\n" .
140 ' <th colspan="2">' . "\n" .
141 ' Total: 4,096 pages / 65,536 KiB' . "\n" .
147 ' <th scope="row">Free pages</th>' . "\n" .
148 ' <td class="font-monospace text-end">0</td>' . "\n" .
151 ' <th scope="row">Dirty pages</th>' . "\n" .
152 ' <td class="font-monospace text-end">0</td>' . "\n" .
155 ' <th scope="row">Pages containing data</th>' . "\n" .
156 ' <td class="font-monospace text-end">0' . "\n" .
160 ' <th scope="row">Pages to be flushed</th>' . "\n" .
161 ' <td class="font-monospace text-end">0' . "\n" .
165 ' <th scope="row">Busy pages</th>' . "\n" .
166 ' <td class="font-monospace text-end">0' . "\n" .
168 ' </tr> </tbody>' . "\n" .
169 '</table>' . "\n\n" .
170 '<table class="table table-striped table-hover w-auto ms-4 float-start caption-top">' . "\n" .
171 ' <caption>' . "\n" .
172 ' Buffer Pool Activity' . "\n" .
173 ' </caption>' . "\n" .
176 ' <th scope="row">Read requests</th>' . "\n" .
177 ' <td class="font-monospace text-end">64' . "\n" .
181 ' <th scope="row">Write requests</th>' . "\n" .
182 ' <td class="font-monospace text-end">64' . "\n" .
186 ' <th scope="row">Read misses</th>' . "\n" .
187 ' <td class="font-monospace text-end">32' . "\n" .
191 ' <th scope="row">Write waits</th>' . "\n" .
192 ' <td class="font-monospace text-end">0' . "\n" .
196 ' <th scope="row">Read misses in %</th>' . "\n" .
197 ' <td class="font-monospace text-end">50 %' . "\n" .
201 ' <th scope="row">Write waits in %</th>' . "\n" .
202 ' <td class="font-monospace text-end">0 %' . "\n" .
207 $this->object->getPageBufferpool(),
212 * Test for getPageStatus
214 public function testGetPageStatus(): void
217 '<pre id="pre_innodb_status">' . "\n\n" . '</pre>' . "\n",
218 $this->object->getPageStatus(),
225 public function testGetPage(): void
229 $this->object->getPage('Status'),
231 $this->object->support
= 2;
233 '<pre id="pre_innodb_status">' . "\n\n" . '</pre>' . "\n",
234 $this->object->getPage('Status'),
239 * Test for getMysqlHelpPage
241 public function testGetMysqlHelpPage(): void
244 'innodb-storage-engine',
245 $this->object->getMysqlHelpPage(),
250 * Test for getInnodbPluginVersion
252 public function testGetInnodbPluginVersion(): void
256 $this->object->getInnodbPluginVersion(),
261 * Test for supportsFilePerTable
263 public function testSupportsFilePerTable(): void
266 $this->object->supportsFilePerTable(),
271 * Test for getInnodbFileFormat
273 public function testGetInnodbFileFormat(): void
277 $this->object->getInnodbFileFormat(),