-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDatabaseIndexingTest.php
More file actions
60 lines (51 loc) · 1.56 KB
/
DatabaseIndexingTest.php
File metadata and controls
60 lines (51 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace cases\database;
use ocunit\library\MySQLPDO;
use PHPUnit\Framework\TestCase;
class DatabaseIndexingTest extends TestCase
{
public function testDropIndexes()
{
#$pdo = new MySQLPDO();
#$pdo->raw("ALTER TABLE `" . DB_PREFIX . "setting` DROP INDEX `store_id`;");
}
public function testApplyIndexes()
{
$pdo = new MySQLPDO();
$pdo->raw("ALTER TABLE `" . DB_PREFIX . "setting` ADD INDEX (`store_id`);");
$this->fail();
}
public function testAnalyseIndexes()
{
$pdo = new MySQLPDO();
$current_indexes_sql = "SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA=:table_schema ORDER BY TABLE_NAME, COLUMN_NAME;";
$current_indexes = $pdo->query($current_indexes_sql, ["table_schema" => DB_DATABASE]);
#print_r($current_indexes);
/**
* [192] => Array
* (
* [TABLE_NAME] => tw_manufacturer_prices
* [COLUMN_NAME] => manufacturer_price_id
* )
*
* [193] => Array
* (
* [TABLE_NAME] => tw_manufacturer_prices
* [COLUMN_NAME] => product_id
* )
*
* [194] => Array
* (
* [TABLE_NAME] => tw_price_history
* [COLUMN_NAME] => history_id
* )
*
* [195] => Array
* (
* [TABLE_NAME] => tw_product_videos
* [COLUMN_NAME] => video_id
* )
*/
$this->fail();
}
}