mirror of
https://github.com/archtechx/virtualcolumn.git
synced 2025-12-12 14:14:05 +00:00
Add encrypted casts test (wip)
This commit is contained in:
parent
0b108903b5
commit
3213a8e856
1 changed files with 16 additions and 0 deletions
|
|
@ -106,6 +106,19 @@ class VirtualColumnTest extends TestCase
|
|||
}
|
||||
|
||||
// maybe add an explicit test that the saving() and updating() listeners don't run twice?
|
||||
|
||||
/** @test */
|
||||
public function encrypted_casts_work_with_virtual_column() {
|
||||
$model = MyModel::create(['password' => $password = 'foo']);
|
||||
|
||||
// Virtual column gets encrypted
|
||||
// todo1 check what value actually got saved in $model->password (should be encrypted 'foo')
|
||||
|
||||
// Virtual column gets decrypted
|
||||
$this->assertSame($model->password, $password);
|
||||
|
||||
// todo1 Check if *all* encrypted casts work
|
||||
}
|
||||
}
|
||||
|
||||
class MyModel extends Model
|
||||
|
|
@ -114,6 +127,9 @@ class MyModel extends Model
|
|||
|
||||
protected $guarded = [];
|
||||
public $timestamps = false;
|
||||
public $casts = [
|
||||
'password'
|
||||
];
|
||||
|
||||
public static function getCustomColumns(): array
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue