Initial commit

This commit is contained in:
2022-11-21 09:47:28 +01:00
commit 76cec83d26
11652 changed files with 1980467 additions and 0 deletions

View File

@ -0,0 +1,128 @@
<?php
/**
* Tests for PMA\libraries\engines\Bdb
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Bdb;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Bdb
*
* @package PhpMyAdmin-test
*/
class BdbTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Bdb('bdb');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getVariables
*
* @return void
*/
public function testGetVariables()
{
$this->assertEquals(
$this->object->getVariables(),
array(
'version_bdb' => array(
'title' => __('Version information'),
),
'bdb_cache_size' => array(
'type' => 1,
),
'bdb_home' => array(
),
'bdb_log_buffer_size' => array(
'type' => 1,
),
'bdb_logdir' => array(
),
'bdb_max_lock' => array(
'type' => 2,
),
'bdb_shared_data' => array(
),
'bdb_tmpdir' => array(
),
'bdb_data_direct' => array(
),
'bdb_lock_detect' => array(
),
'bdb_log_direct' => array(
),
'bdb_no_recover' => array(
),
'bdb_no_sync' => array(
),
'skip_sync_bdb_logs' => array(
),
'sync_bdb_logs' => array(
),
)
);
}
/**
* Test for getVariablesLikePattern
*
* @return void
*/
public function testGetVariablesLikePattern()
{
$this->assertEquals(
$this->object->getVariablesLikePattern(),
'%bdb%'
);
}
/**
* Test for getMysqlHelpPage
*
* @return void
*/
public function testGetMysqlHelpPage()
{
$this->assertEquals(
$this->object->getMysqlHelpPage(),
'bdb'
);
}
}

View File

@ -0,0 +1,67 @@
<?php
/**
* Tests for PMA_StorageEngine_binlog
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Binlog;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Binlog
*
* @package PhpMyAdmin-test
*/
class BinlogTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Binlog('binlog');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getMysqlHelpPage
*
* @return void
*/
public function testGetMysqlHelpPage()
{
$this->assertEquals(
$this->object->getMysqlHelpPage(),
'binary-log'
);
}
}

View File

@ -0,0 +1,367 @@
<?php
/**
* Tests for PMA_StorageEngine_innodb
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Innodb;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Innodb
*
* @package PhpMyAdmin-test
*/
class InnodbTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Innodb('innodb');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getVariables
*
* @return void
*/
public function testGetVariables()
{
$this->assertEquals(
array(
'innodb_data_home_dir' => array(
'title' => __('Data home directory'),
'desc' => __('The common part of the directory path for all InnoDB data files.'),
),
'innodb_data_file_path' => array(
'title' => __('Data files'),
),
'innodb_autoextend_increment' => array(
'title' => __('Autoextend increment'),
'desc' => __('The increment size for extending the size of an autoextending tablespace when it becomes full.'),
'type' => 2,
),
'innodb_buffer_pool_size' => array(
'title' => __('Buffer pool size'),
'desc' => __('The size of the memory buffer InnoDB uses to cache data and indexes of its tables.'),
'type' => 1,
),
'innodb_additional_mem_pool_size' => array(
'title' => 'innodb_additional_mem_pool_size',
'type' => 1,
),
'innodb_buffer_pool_awe_mem_mb' => array(
'type' => 1,
),
'innodb_checksums' => array(
),
'innodb_commit_concurrency' => array(
),
'innodb_concurrency_tickets' => array(
'type' => 2,
),
'innodb_doublewrite' => array(
),
'innodb_fast_shutdown' => array(
),
'innodb_file_io_threads' => array(
'type' => 2,
),
'innodb_file_per_table' => array(
),
'innodb_flush_log_at_trx_commit' => array(
),
'innodb_flush_method' => array(
),
'innodb_force_recovery' => array(
),
'innodb_lock_wait_timeout' => array(
'type' => 2,
),
'innodb_locks_unsafe_for_binlog' => array(
),
'innodb_log_arch_dir' => array(
),
'innodb_log_archive' => array(
),
'innodb_log_buffer_size' => array(
'type' => 1,
),
'innodb_log_file_size' => array(
'type' => 1,
),
'innodb_log_files_in_group' => array(
'type' => 2,
),
'innodb_log_group_home_dir' => array(
),
'innodb_max_dirty_pages_pct' => array(
'type' => 2,
),
'innodb_max_purge_lag' => array(
),
'innodb_mirrored_log_groups' => array(
'type' => 2,
),
'innodb_open_files' => array(
'type' => 2,
),
'innodb_support_xa' => array(
),
'innodb_sync_spin_loops' => array(
'type' => 2,
),
'innodb_table_locks' => array(
'type' => 3,
),
'innodb_thread_concurrency' => array(
'type' => 2,
),
'innodb_thread_sleep_delay' => array(
'type' => 2,
),
),
$this->object->getVariables()
);
}
/**
* Test for getVariablesLikePattern
*
* @return void
*/
public function testGetVariablesLikePattern()
{
$this->assertEquals(
'innodb\\_%',
$this->object->getVariablesLikePattern()
);
}
/**
* Test for getInfoPages
*
* @return void
*/
public function testGetInfoPages()
{
$this->assertEquals(
array(),
$this->object->getInfoPages()
);
$this->object->support = 2;
$this->assertEquals(
array (
'Bufferpool' => 'Buffer Pool',
'Status' => 'InnoDB Status'
),
$this->object->getInfoPages()
);
}
/**
* Test for getPageBufferpool
*
* @return void
*/
public function testGetPageBufferpool()
{
$this->assertEquals(
'<table class="data" id="table_innodb_bufferpool_usage">
<caption class="tblHeaders">
Buffer Pool Usage
</caption>
<tfoot>
<tr>
<th colspan="2">
Total
: 4,096&nbsp;pages / 65,536&nbsp;KiB
</th>
</tr>
</tfoot>
<tbody>
<tr class="odd">
<th>Free pages</th>
<td class="value">0</td>
</tr>
<tr class="even">
<th>Dirty pages</th>
<td class="value">0</td>
</tr>
<tr class="odd">
<th>Pages containing data</th>
<td class="value">0
</td>
</tr>
<tr class="even">
<th>Pages to be flushed</th>
<td class="value">0
</td>
</tr>
<tr class="odd">
<th>Busy pages</th>
<td class="value">0
</td>
</tr> </tbody>
</table>
<table class="data" id="table_innodb_bufferpool_activity">
<caption class="tblHeaders">
Buffer Pool Activity
</caption>
<tbody>
<tr class="odd">
<th>Read requests</th>
<td class="value">64
</td>
</tr>
<tr class="even">
<th>Write requests</th>
<td class="value">64
</td>
</tr>
<tr class="odd">
<th>Read misses</th>
<td class="value">32
</td>
</tr>
<tr class="even">
<th>Write waits</th>
<td class="value">0
</td>
</tr>
<tr class="odd">
<th>Read misses in %</th>
<td class="value">50 %
</td>
</tr>
<tr class="even">
<th>Write waits in %</th>
<td class="value">0 %
</td>
</tr>
</tbody>
</table>
',
$this->object->getPageBufferpool()
);
}
/**
* Test for getPageStatus
*
* @return void
*/
public function testGetPageStatus()
{
$this->assertEquals(
'<pre id="pre_innodb_status">' . "\n" . "\n" . '</pre>' . "\n",
$this->object->getPageStatus()
);
}
/**
* Test for getPage
*
* @return void
*/
public function testGetPage()
{
$this->assertEquals(
'',
$this->object->getPage('Status')
);
$this->object->support = 2;
$this->assertEquals(
'<pre id="pre_innodb_status">' . "\n" . "\n" . '</pre>' . "\n",
$this->object->getPage('Status')
);
}
/**
* Test for getMysqlHelpPage
*
* @return void
*/
public function testGetMysqlHelpPage()
{
$this->assertEquals(
'innodb-storage-engine',
$this->object->getMysqlHelpPage()
);
}
/**
* Test for getInnodbPluginVersion
*
* @return void
*/
public function testGetInnodbPluginVersion()
{
$this->assertEquals(
'1.1.8',
$this->object->getInnodbPluginVersion()
);
}
/**
* Test for supportsFilePerTable
*
* @return void
*/
public function testSupportsFilePerTable()
{
$this->assertFalse(
$this->object->supportsFilePerTable()
);
}
/**
* Test for getInnodbFileFormat
*
* @return void
*/
public function testGetInnodbFileFormat()
{
$this->assertEquals(
'Antelope',
$this->object->getInnodbFileFormat()
);
}
}

View File

@ -0,0 +1,70 @@
<?php
/**
* Tests for PMA_StorageEngine_memory
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Memory;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Memory
*
* @package PhpMyAdmin-test
*/
class MemoryTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Memory('memory');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getVariables
*
* @return void
*/
public function testGetVariables()
{
$this->assertEquals(
$this->object->getVariables(),
array(
'max_heap_table_size' => array(
'type' => 1,
)
)
);
}
}

View File

@ -0,0 +1,67 @@
<?php
/**
* Tests for PMA\libraries\engines\Mrg_Myisam
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Mrg_Myisam;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Mrg_Myisam
*
* @package PhpMyAdmin-test
*/
class Mrg_MyisamTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Mrg_Myisam('mrg_myisam');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getMysqlHelpPage
*
* @return void
*/
public function testGetMysqlHelpPage()
{
$this->assertEquals(
$this->object->getMysqlHelpPage(),
'merge-storage-engine'
);
}
}

View File

@ -0,0 +1,107 @@
<?php
/**
* Tests for PMA_StorageEngine_myisam
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Myisam;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Myisam
*
* @package PhpMyAdmin-test
*/
class MyisamTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Myisam('myisam');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getVariables
*
* @return void
*/
public function testGetVariables()
{
$this->assertEquals(
$this->object->getVariables(),
array(
'myisam_data_pointer_size' => array(
'title' => __('Data pointer size'),
'desc' => __('The default pointer size in bytes, to be used by CREATE TABLE for MyISAM tables when no MAX_ROWS option is specified.'),
'type' => 1,
),
'myisam_recover_options' => array(
'title' => __('Automatic recovery mode'),
'desc' => __('The mode for automatic recovery of crashed MyISAM tables, as set via the --myisam-recover server startup option.'),
),
'myisam_max_sort_file_size' => array(
'title' => __('Maximum size for temporary sort files'),
'desc' => __('The maximum size of the temporary file MySQL is allowed to use while re-creating a MyISAM index (during REPAIR TABLE, ALTER TABLE, or LOAD DATA INFILE).'),
'type' => 1,
),
'myisam_max_extra_sort_file_size' => array(
'title' => __('Maximum size for temporary files on index creation'),
'desc' => __('If the temporary file used for fast MyISAM index creation would be larger than using the key cache by the amount specified here, prefer the key cache method.'),
'type' => 1,
),
'myisam_repair_threads' => array(
'title' => __('Repair threads'),
'desc' => __('If this value is greater than 1, MyISAM table indexes are created in parallel (each index in its own thread) during the repair by sorting process.'),
'type' => 2,
),
'myisam_sort_buffer_size' => array(
'title' => __('Sort buffer size'),
'desc' => __('The buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE or when creating indexes with CREATE INDEX or ALTER TABLE.'),
'type' => 1,
),
'myisam_stats_method' => array(
),
'delay_key_write' => array(
),
'bulk_insert_buffer_size' => array(
'type' => 1,
),
'skip_external_locking' => array(
),
)
);
}
}

View File

@ -0,0 +1,96 @@
<?php
/**
* Tests for PMA_StorageEngine_ndbcluster
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Ndbcluster;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Ndbcluster
*
* @package PhpMyAdmin-test
*/
class NdbclusterTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Ndbcluster('nbdcluster');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getVariables
*
* @return void
*/
public function testGetVariables()
{
$this->assertEquals(
$this->object->getVariables(),
array(
'ndb_connectstring' => array(
),
)
);
}
/**
* Test for getVariablesLikePattern
*
* @return void
*/
public function testGetVariablesLikePattern()
{
$this->assertEquals(
$this->object->getVariablesLikePattern(),
'ndb\\_%'
);
}
/**
* Test for getMysqlHelpPage
*
* @return void
*/
public function testGetMysqlHelpPage()
{
$this->assertEquals(
$this->object->getMysqlHelpPage(),
'ndbcluster'
);
}
}

View File

@ -0,0 +1,266 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Tests for PMA_StorageEngine_pbxt
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
use PMA\libraries\engines\Pbxt;
require_once 'libraries/database_interface.inc.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\engines\Pbxt;
*
* @package PhpMyAdmin-test
*/
class PbxtTest extends PMATestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['server'] = 0;
$this->object = new Pbxt('pbxt');
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for getVariables
*
* @return void
*/
public function testGetVariables()
{
$this->assertEquals(
$this->object->getVariables(),
array(
'pbxt_index_cache_size' => array(
'title' => __('Index cache size'),
'desc' => __(
'This is the amount of memory allocated to the'
. ' index cache. Default value is 32MB. The memory'
. ' allocated here is used only for caching index pages.'
),
'type' => 1
),
'pbxt_record_cache_size' => array(
'title' => __('Record cache size'),
'desc' => __(
'This is the amount of memory allocated to the'
. ' record cache used to cache table data. The default'
. ' value is 32MB. This memory is used to cache changes to'
. ' the handle data (.xtd) and row pointer (.xtr) files.'
),
'type' => 1
),
'pbxt_log_cache_size' => array(
'title' => __('Log cache size'),
'desc' => __(
'The amount of memory allocated to the'
. ' transaction log cache used to cache on transaction log'
. ' data. The default is 16MB.'
),
'type' => 1
),
'pbxt_log_file_threshold' => array(
'title' => __('Log file threshold'),
'desc' => __(
'The size of a transaction log before rollover,'
. ' and a new log is created. The default value is 16MB.'
),
'type' => 1
),
'pbxt_transaction_buffer_size' => array(
'title' => __('Transaction buffer size'),
'desc' => __(
'The size of the global transaction log buffer'
. ' (the engine allocates 2 buffers of this size).'
. ' The default is 1MB.'
),
'type' => 1
),
'pbxt_checkpoint_frequency' => array(
'title' => __('Checkpoint frequency'),
'desc' => __(
'The amount of data written to the transaction'
. ' log before a checkpoint is performed.'
. ' The default value is 24MB.'
),
'type' => 1
),
'pbxt_data_log_threshold' => array(
'title' => __('Data log threshold'),
'desc' => __(
'The maximum size of a data log file. The default'
. ' value is 64MB. PBXT can create a maximum of 32000 data'
. ' logs, which are used by all tables. So the value of'
. ' this variable can be increased to increase the total'
. ' amount of data that can be stored in the database.'
),
'type' => 1
),
'pbxt_garbage_threshold' => array(
'title' => __('Garbage threshold'),
'desc' => __(
'The percentage of garbage in a data log file'
. ' before it is compacted. This is a value between 1 and'
. ' 99. The default is 50.'
),
'type' => 2
),
'pbxt_log_buffer_size' => array(
'title' => __('Log buffer size'),
'desc' => __(
'The size of the buffer used when writing a data'
. ' log. The default is 256MB. The engine allocates one'
. ' buffer per thread, but only if the thread is required'
. ' to write a data log.'
),
'type' => 1
),
'pbxt_data_file_grow_size' => array(
'title' => __('Data file grow size'),
'desc' => __('The grow size of the handle data (.xtd) files.'),
'type' => 1
),
'pbxt_row_file_grow_size' => array(
'title' => __('Row file grow size'),
'desc' => __('The grow size of the row pointer (.xtr) files.'),
'type' => 1
),
'pbxt_log_file_count' => array(
'title' => __('Log file count'),
'desc' => __(
'This is the number of transaction log files'
. ' (pbxt/system/xlog*.xt) the system will maintain. If the'
. ' number of logs exceeds this value then old logs will be'
. ' deleted, otherwise they are renamed and given the next'
. ' highest number.'
),
'type' => 2
),
)
);
}
/**
* Test for resolveTypeSize
*
* @param string $formatted_size the size expression (for example 8MB)
* @param string $output Expected output
*
* @dataProvider providerFortTestResolveTypeSize
*
* @return void
*/
public function testResolveTypeSize($formatted_size, $output)
{
$this->assertEquals(
$this->object->resolveTypeSize($formatted_size),
$output
);
}
/**
* Provider for testResolveTypeSize
*
* @return array
*/
public function providerFortTestResolveTypeSize()
{
return array(
array(
'8MB',
array (
0 => '8,192',
1 => 'KiB'
)
),
array(
'10mb',
array (
0 => '-1',
1 => 'B'
)
),
array(
'A4',
array (
0 => '0',
1 => 'B'
)
)
);
}
/**
* Test for getInfoPages
*
* @return void
*/
public function testGetInfoPages()
{
$this->assertEquals(
$this->object->getInfoPages(),
array(
'Documentation' => 'Documentation'
)
);
}
/**
* Test for getPage
*
* @return void
*/
public function testGetPage()
{
$this->assertEquals(
$this->object->getPage('Documentation'),
'<p>'
. sprintf(
__(
'Documentation and further information about PBXT'
. ' can be found on the %sPrimeBase XT Home Page%s.'
),
'<a href="' . PMA_linkURL('https://mariadb.com/kb/en/mariadb/about-pbxt/')
. '" rel="noopener noreferrer" target="_blank">',
'</a>'
)
. '</p>' . "\n"
);
$this->assertEquals(
$this->object->getPage('NonExistMethod'),
false
);
}
}