@@ -5577,18 +5577,48 @@ public function testCreateFulltextIndex(): void {
55775577 $ this ->assertQuery ( 'CREATE TABLE t (id INT, value TEXT) ' );
55785578 $ this ->assertQuery ( 'CREATE FULLTEXT INDEX idx_value ON t (value) ' );
55795579
5580+ // Verify that the index was saved in the information schema.
55805581 $ result = $ this ->assertQuery ( 'SHOW INDEX FROM t ' );
55815582 $ this ->assertCount ( 1 , $ result );
55825583 $ this ->assertEquals ( 'FULLTEXT ' , $ result [0 ]->Index_type );
5584+
5585+ // Verify that the index exists in the SQLite database.
5586+ $ result = $ this ->engine ->execute_sqlite_query ( "PRAGMA index_list('t') " )->fetchAll ( PDO ::FETCH_ASSOC );
5587+ $ this ->assertCount ( 1 , $ result );
5588+ $ this ->assertEquals (
5589+ array (
5590+ 'seq ' => '0 ' ,
5591+ 'name ' => 't__idx_value ' ,
5592+ 'unique ' => '0 ' ,
5593+ 'origin ' => 'c ' ,
5594+ 'partial ' => '0 ' ,
5595+ ),
5596+ $ result [0 ]
5597+ );
55835598 }
55845599
55855600 public function testCreateSpatialIndex (): void {
55865601 $ this ->assertQuery ( 'CREATE TABLE t (id INT, value POINT NOT NULL) ' );
55875602 $ this ->assertQuery ( 'CREATE SPATIAL INDEX idx_value ON t (value) ' );
55885603
5604+ // Verify that the index was saved in the information schema.
55895605 $ result = $ this ->assertQuery ( 'SHOW INDEX FROM t ' );
55905606 $ this ->assertCount ( 1 , $ result );
55915607 $ this ->assertEquals ( 'SPATIAL ' , $ result [0 ]->Index_type );
5608+
5609+ // Verify that the index exists in the SQLite database.
5610+ $ result = $ this ->engine ->execute_sqlite_query ( "PRAGMA index_list('t') " )->fetchAll ( PDO ::FETCH_ASSOC );
5611+ $ this ->assertCount ( 1 , $ result );
5612+ $ this ->assertEquals (
5613+ array (
5614+ 'seq ' => '0 ' ,
5615+ 'name ' => 't__idx_value ' ,
5616+ 'unique ' => '0 ' ,
5617+ 'origin ' => 'c ' ,
5618+ 'partial ' => '0 ' ,
5619+ ),
5620+ $ result [0 ]
5621+ );
55925622 }
55935623
55945624 public function testCreateIndexWithOrder (): void {
@@ -5639,9 +5669,24 @@ public function testCreateIndexWithComment(): void {
56395669 $ this ->assertQuery ( 'CREATE TABLE t (id INT, value INT) ' );
56405670 $ this ->assertQuery ( 'CREATE INDEX idx_value ON t (value) COMMENT "Test comment" ' );
56415671
5672+ // Verify that the index was saved in the information schema.
56425673 $ result = $ this ->assertQuery ( 'SHOW INDEX FROM t ' );
56435674 $ this ->assertCount ( 1 , $ result );
56445675 $ this ->assertEquals ( 'Test comment ' , $ result [0 ]->Index_comment );
5676+
5677+ // Verify that the index exists in the SQLite database.
5678+ $ result = $ this ->engine ->execute_sqlite_query ( "PRAGMA index_list('t') " )->fetchAll ( PDO ::FETCH_ASSOC );
5679+ $ this ->assertCount ( 1 , $ result );
5680+ $ this ->assertEquals (
5681+ array (
5682+ 'seq ' => '0 ' ,
5683+ 'name ' => 't__idx_value ' ,
5684+ 'unique ' => '0 ' ,
5685+ 'origin ' => 'c ' ,
5686+ 'partial ' => '0 ' ,
5687+ ),
5688+ $ result [0 ]
5689+ );
56455690 }
56465691
56475692 public function testCreateIndexWithDuplicateName (): void {
@@ -5656,8 +5701,10 @@ public function testCreateIndexWithDuplicateName(): void {
56565701
56575702 public function testCreateIndexOnNonExistentColumn (): void {
56585703 $ this ->assertQuery ( 'CREATE TABLE t (id INT) ' );
5704+
56595705 $ this ->expectException ( WP_SQLite_Driver_Exception::class );
56605706 $ this ->expectExceptionMessage ( "SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'val' doesn't exist in table " );
5707+
56615708 $ this ->assertQuery ( 'CREATE INDEX idx_value ON t (val) ' );
56625709 }
56635710
0 commit comments