File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -530,7 +530,20 @@ jobs:
530530 open(path, 'w').write(src)
531531 print('patched sync_column_key_info UPDATE')
532532
533- # 2. wp_die polyfill: real WordPress provides wp_die(); the unit-test
533+ # 2. Turso doesn't implement `PRAGMA foreign_key_check`. The driver
534+ # runs it after every ALTER TABLE to validate foreign keys; its
535+ # failure breaks ~34 tests. Skip it under Turso by wrapping in
536+ # a try/catch that swallows the "Not a valid pragma name" error.
537+ path = 'src/sqlite/class-wp-pdo-mysql-on-sqlite.php'
538+ src = open(path).read()
539+ old = "\t\t\t$this->execute_sqlite_query( 'PRAGMA foreign_key_check' );"
540+ new = "\t\t\ttry { $this->execute_sqlite_query( 'PRAGMA foreign_key_check' ); } catch ( \\PDOException $e ) { /* Turso: not implemented */ }"
541+ assert old in src, 'PRAGMA foreign_key_check not found'
542+ src = src.replace(old, new, 1)
543+ open(path, 'w').write(src)
544+ print('patched PRAGMA foreign_key_check')
545+
546+ # 3. wp_die polyfill: real WordPress provides wp_die(); the unit-test
534547 # bootstrap doesn't, so tests hit an 'undefined function' error when
535548 # a driver error path tries to call it.
536549 path = 'tests/bootstrap.php'
You can’t perform that action at this time.
0 commit comments