3 * Tests for PMA_StorageEngine_pbxt
6 declare(strict_types
=1);
8 namespace PhpMyAdmin\Tests\Engines
;
11 use PhpMyAdmin\Engines\Pbxt
;
12 use PhpMyAdmin\Tests\AbstractTestCase
;
15 class PbxtTest
extends AbstractTestCase
21 * Sets up the fixture, for example, opens a network connection.
22 * This method is called before a test is executed.
26 protected function setUp(): void
29 parent
::loadDefaultConfig();
31 $GLOBALS['server'] = 0;
32 $this->object = new Pbxt('pbxt');
36 * Tears down the fixture, for example, closes a network connection.
37 * This method is called after a test is executed.
41 protected function tearDown(): void
48 * Test for getVariables
50 public function testGetVariables(): void
53 $this->object->getVariables(),
55 'pbxt_index_cache_size' => [
56 'title' => __('Index cache size'),
58 'This is the amount of memory allocated to the'
59 . ' index cache. Default value is 32MB. The memory'
60 . ' allocated here is used only for caching index pages.'
64 'pbxt_record_cache_size' => [
65 'title' => __('Record cache size'),
67 'This is the amount of memory allocated to the'
68 . ' record cache used to cache table data. The default'
69 . ' value is 32MB. This memory is used to cache changes to'
70 . ' the handle data (.xtd) and row pointer (.xtr) files.'
74 'pbxt_log_cache_size' => [
75 'title' => __('Log cache size'),
77 'The amount of memory allocated to the'
78 . ' transaction log cache used to cache on transaction log'
79 . ' data. The default is 16MB.'
83 'pbxt_log_file_threshold' => [
84 'title' => __('Log file threshold'),
86 'The size of a transaction log before rollover,'
87 . ' and a new log is created. The default value is 16MB.'
91 'pbxt_transaction_buffer_size' => [
92 'title' => __('Transaction buffer size'),
94 'The size of the global transaction log buffer'
95 . ' (the engine allocates 2 buffers of this size).'
96 . ' The default is 1MB.'
100 'pbxt_checkpoint_frequency' => [
101 'title' => __('Checkpoint frequency'),
103 'The amount of data written to the transaction'
104 . ' log before a checkpoint is performed.'
105 . ' The default value is 24MB.'
109 'pbxt_data_log_threshold' => [
110 'title' => __('Data log threshold'),
112 'The maximum size of a data log file. The default'
113 . ' value is 64MB. PBXT can create a maximum of 32000 data'
114 . ' logs, which are used by all tables. So the value of'
115 . ' this variable can be increased to increase the total'
116 . ' amount of data that can be stored in the database.'
120 'pbxt_garbage_threshold' => [
121 'title' => __('Garbage threshold'),
123 'The percentage of garbage in a data log file'
124 . ' before it is compacted. This is a value between 1 and'
125 . ' 99. The default is 50.'
129 'pbxt_log_buffer_size' => [
130 'title' => __('Log buffer size'),
132 'The size of the buffer used when writing a data'
133 . ' log. The default is 256MB. The engine allocates one'
134 . ' buffer per thread, but only if the thread is required'
135 . ' to write a data log.'
139 'pbxt_data_file_grow_size' => [
140 'title' => __('Data file grow size'),
141 'desc' => __('The grow size of the handle data (.xtd) files.'),
144 'pbxt_row_file_grow_size' => [
145 'title' => __('Row file grow size'),
146 'desc' => __('The grow size of the row pointer (.xtr) files.'),
149 'pbxt_log_file_count' => [
150 'title' => __('Log file count'),
152 'This is the number of transaction log files'
153 . ' (pbxt/system/xlog*.xt) the system will maintain. If the'
154 . ' number of logs exceeds this value then old logs will be'
155 . ' deleted, otherwise they are renamed and given the next'
165 * Test for resolveTypeSize
167 * @param string $formatted_size the size expression (for example 8MB)
168 * @param array $output Expected output
170 * @dataProvider providerFortTestResolveTypeSize
172 public function testResolveTypeSize(string $formatted_size, array $output): void
175 $this->object->resolveTypeSize($formatted_size),
181 * Provider for testResolveTypeSize
185 public function providerFortTestResolveTypeSize(): array
213 * Test for getInfoPages
215 public function testGetInfoPages(): void
218 $this->object->getInfoPages(),
219 ['Documentation' => 'Documentation']
226 public function testGetPage(): void
229 $this->object->getPage('Documentation'),
233 'Documentation and further information about PBXT'
234 . ' can be found on the %sPrimeBase XT Home Page%s.'
236 '<a href="' . Core
::linkURL('https://mariadb.com/kb/en/mariadb/about-pbxt/')
237 . '" rel="noopener noreferrer" target="_blank">',
244 $this->object->getPage('NonExistMethod'),