diff --git a/Tests/Public/Encryption/EncryptionTests.swift b/Tests/Public/Encryption/EncryptionTests.swift index 991fe8dc5..fbc094bd3 100644 --- a/Tests/Public/Encryption/EncryptionTests.swift +++ b/Tests/Public/Encryption/EncryptionTests.swift @@ -193,7 +193,21 @@ class EncryptionTests: GRDBTestCase { } } - func testPragmaCompatibility() { - + func testDatabaseQueueWithPragmaPassphraseToDatabaseQueueWithPassphrase() { + assertNoError { + do { + dbConfiguration.passphrase = nil + let dbQueue = try makeDatabaseQueue() + try dbQueue.execute("PRAGMA key = 'secret'") + try dbQueue.execute("CREATE TABLE data (value INTEGER)") + try dbQueue.execute("INSERT INTO data (value) VALUES (1)") + } + + do { + dbConfiguration.passphrase = "secret" + let dbQueue = try makeDatabaseQueue() + XCTAssertEqual(Int.fetchOne(dbQueue, "SELECT value FROM data")!, 1) + } + } } }