Translated using Weblate (Portuguese)
[phpmyadmin.git] / tests / unit / Engines / InnodbTest.php
blobb1a66c4bdd86997d4bf654329735022d7245925a
1 <?php
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;
12 use function __;
14 #[CoversClass(Innodb::class)]
15 class InnodbTest extends AbstractTestCase
17 protected Innodb $object;
19 /**
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
25 parent::setUp();
27 DatabaseInterface::$instance = $this->createDatabaseInterface();
28 $this->object = new Innodb('innodb');
31 /**
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
37 parent::tearDown();
39 unset($this->object);
42 /**
43 * Test for getVariables
45 public function testGetVariables(): void
47 self::assertSame(
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'),
56 'desc' => __(
57 'The increment size for extending the size of'
58 . ' an autoextending tablespace when it becomes full.',
60 'type' => 2,
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.'),
65 'type' => 1,
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
106 self::assertSame(
107 'innodb\\_%',
108 $this->object->getVariablesLikePattern(),
113 * Test for getInfoPages
115 public function testGetInfoPages(): void
117 self::assertSame(
119 $this->object->getInfoPages(),
121 $this->object->support = 2;
122 self::assertSame(
123 ['Bufferpool' => 'Buffer Pool', 'Status' => 'InnoDB Status'],
124 $this->object->getInfoPages(),
129 * Test for getPageBufferpool
131 public function testGetPageBufferpool(): void
133 self::assertSame(
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" .
138 ' <tfoot>' . "\n" .
139 ' <tr>' . "\n" .
140 ' <th colspan="2">' . "\n" .
141 ' Total: 4,096&nbsp;pages / 65,536&nbsp;KiB' . "\n" .
142 ' </th>' . "\n" .
143 ' </tr>' . "\n" .
144 ' </tfoot>' . "\n" .
145 ' <tbody>' . "\n" .
146 ' <tr>' . "\n" .
147 ' <th scope="row">Free pages</th>' . "\n" .
148 ' <td class="font-monospace text-end">0</td>' . "\n" .
149 ' </tr>' . "\n" .
150 ' <tr>' . "\n" .
151 ' <th scope="row">Dirty pages</th>' . "\n" .
152 ' <td class="font-monospace text-end">0</td>' . "\n" .
153 ' </tr>' . "\n" .
154 ' <tr>' . "\n" .
155 ' <th scope="row">Pages containing data</th>' . "\n" .
156 ' <td class="font-monospace text-end">0' . "\n" .
157 '</td>' . "\n" .
158 ' </tr>' . "\n" .
159 ' <tr>' . "\n" .
160 ' <th scope="row">Pages to be flushed</th>' . "\n" .
161 ' <td class="font-monospace text-end">0' . "\n" .
162 '</td>' . "\n" .
163 ' </tr>' . "\n" .
164 ' <tr>' . "\n" .
165 ' <th scope="row">Busy pages</th>' . "\n" .
166 ' <td class="font-monospace text-end">0' . "\n" .
167 '</td>' . "\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" .
174 ' <tbody>' . "\n" .
175 ' <tr>' . "\n" .
176 ' <th scope="row">Read requests</th>' . "\n" .
177 ' <td class="font-monospace text-end">64' . "\n" .
178 '</td>' . "\n" .
179 ' </tr>' . "\n" .
180 ' <tr>' . "\n" .
181 ' <th scope="row">Write requests</th>' . "\n" .
182 ' <td class="font-monospace text-end">64' . "\n" .
183 '</td>' . "\n" .
184 ' </tr>' . "\n" .
185 ' <tr>' . "\n" .
186 ' <th scope="row">Read misses</th>' . "\n" .
187 ' <td class="font-monospace text-end">32' . "\n" .
188 '</td>' . "\n" .
189 ' </tr>' . "\n" .
190 ' <tr>' . "\n" .
191 ' <th scope="row">Write waits</th>' . "\n" .
192 ' <td class="font-monospace text-end">0' . "\n" .
193 '</td>' . "\n" .
194 ' </tr>' . "\n" .
195 ' <tr>' . "\n" .
196 ' <th scope="row">Read misses in %</th>' . "\n" .
197 ' <td class="font-monospace text-end">50 %' . "\n" .
198 '</td>' . "\n" .
199 ' </tr>' . "\n" .
200 ' <tr>' . "\n" .
201 ' <th scope="row">Write waits in %</th>' . "\n" .
202 ' <td class="font-monospace text-end">0 %' . "\n" .
203 '</td>' . "\n" .
204 ' </tr>' . "\n" .
205 ' </tbody>' . "\n" .
206 '</table>' . "\n",
207 $this->object->getPageBufferpool(),
212 * Test for getPageStatus
214 public function testGetPageStatus(): void
216 self::assertSame(
217 '<pre id="pre_innodb_status">' . "\n\n" . '</pre>' . "\n",
218 $this->object->getPageStatus(),
223 * Test for getPage
225 public function testGetPage(): void
227 self::assertSame(
229 $this->object->getPage('Status'),
231 $this->object->support = 2;
232 self::assertSame(
233 '<pre id="pre_innodb_status">' . "\n\n" . '</pre>' . "\n",
234 $this->object->getPage('Status'),
239 * Test for getMysqlHelpPage
241 public function testGetMysqlHelpPage(): void
243 self::assertSame(
244 'innodb-storage-engine',
245 $this->object->getMysqlHelpPage(),
250 * Test for getInnodbPluginVersion
252 public function testGetInnodbPluginVersion(): void
254 self::assertSame(
255 '1.1.8',
256 $this->object->getInnodbPluginVersion(),
261 * Test for supportsFilePerTable
263 public function testSupportsFilePerTable(): void
265 self::assertFalse(
266 $this->object->supportsFilePerTable(),
271 * Test for getInnodbFileFormat
273 public function testGetInnodbFileFormat(): void
275 self::assertSame(
276 'Antelope',
277 $this->object->getInnodbFileFormat(),