mirror of
https://github.com/archtechx/virtualcolumn.git
synced 2025-12-12 12:14:03 +00:00
Test that with encrypted casts, the encrypted values are saved in the DB (#21)
This commit is contained in:
parent
75718edcfe
commit
9da2d6fe8d
1 changed files with 3 additions and 0 deletions
|
|
@ -146,11 +146,14 @@ class VirtualColumnTest extends TestCase
|
||||||
'null_value' => null, // 'encrypted'
|
'null_value' => null, // 'encrypted'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$databaseRecord = json_decode(DB::select('SELECT data FROM my_models')[0]->data);
|
||||||
|
|
||||||
foreach($encryptedAttributes as $key => $expectedValue) {
|
foreach($encryptedAttributes as $key => $expectedValue) {
|
||||||
$savedValue = $model->getAttributes()[$key]; // Encrypted
|
$savedValue = $model->getAttributes()[$key]; // Encrypted
|
||||||
|
|
||||||
if ($savedValue !== null) {
|
if ($savedValue !== null) {
|
||||||
$this->assertTrue($model->valueEncrypted($savedValue));
|
$this->assertTrue($model->valueEncrypted($savedValue));
|
||||||
|
$this->assertEquals($savedValue, $databaseRecord->$key); // Encrypted in DB
|
||||||
$this->assertNotEquals($expectedValue, $savedValue);
|
$this->assertNotEquals($expectedValue, $savedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue