Skip to content

Commit eb56f6c

Browse files
committed
Test that with encrypted casts, the encrypted values are saved in the DB
1 parent 65f9000 commit eb56f6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/VirtualColumnTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,14 @@ public function encrypted_casts_work_with_virtual_column() {
146146
'null_value' => null, // 'encrypted'
147147
]);
148148

149+
$databaseRecord = json_decode(DB::select('SELECT data FROM my_models')[0]->data);
150+
149151
foreach($encryptedAttributes as $key => $expectedValue) {
150152
$savedValue = $model->getAttributes()[$key]; // Encrypted
151153

152154
if ($savedValue !== null) {
153155
$this->assertTrue($model->valueEncrypted($savedValue));
156+
$this->assertEquals($savedValue, $databaseRecord->$key); // Encrypted in DB
154157
$this->assertNotEquals($expectedValue, $savedValue);
155158
}
156159

0 commit comments

Comments
 (0)