1
0
Fork 0
mirror of https://github.com/archtechx/virtualcolumn.git synced 2025-12-12 20:14:03 +00:00
Commit graph

12 commits

Author SHA1 Message Date
lukinovec
ac55a5b5ec Add regression test for timestamps being included in the data column 2025-07-22 09:43:26 +02:00
lukinovec
0f4d04ee4f Make running tests work with new PHPUnit version 2025-07-21 12:56:13 +02:00
Nick
65f9000328
Handle encrypted columns which are set to null (#19)
* 🧪 Add a test for a null value

* 🐛 Don't consider null types for decryption
2024-04-07 20:26:29 +02:00
Samuel Štancl
89e00fbcd9 make getCustomColumns() and getDataColumn() static again 2023-11-08 22:32:12 +01:00
lukinovec
72de33a3d4
Add encrypted casts support + allow using the trait on multiple models (#14)
* Add encrypted casts test (wip)

* Handle and test 'encrypted' casts

* Add APP_KEY to phpunit.xml

* Update attribute casting in VirtualColumn

* Test casting of all default 'encrypted' castables

* Fix code style (php-cs-fixer)

* Handle custom castables in VirtualColumn

* Add custom encrypted castable

* Test custom encrypted castable, refactor test

* Move EncryptedCast class to VirtualColumnTest

* Correct expected/actual value order in assertions

* Break code style (testing)

* Fix code style (php-cs-fixer)

* Check Laravel CI version (testing)

* dd() Laravel version

* Delete dd()

* Delete get() and set() types

* Use non-lowercase custom cast class strings

* Check hasCast manually

* Correct encrypted castable logic

* Update src/VirtualColumn.php

* Use `$dataEncoded` bool instead of `$dataEncodingStatus` string

* Don't accept unused `$e`

* Refactor `encodeAttributes()`

* Use `$model->getCustomColumns()` instead of `static::getCustomColumns()`

* Use `$model` instead of `static` where possible

* Correct test

* Revert `static` -> `$model` changes

* Correct typo

* Refactor `$afterListeneres`

* Fix code style (php-cs-fixer)

* Make static things non-static in VirtualColumn

* Change method to non-static in test

* Add base class that uses VirtualColumn in tests

* Add encrypted castables docblock

* Fix merge

* Fix ParentModel change

* make $this and $model use clear and consistent

---------

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2023-11-08 10:08:34 +01:00
lukinovec
925249bb72
Test that child models extending a parent that uses VirtualColumn get encoded correctly (#16)
* Test that using different models extending the same class with VirtualColumn doesn't work correctly

* Add regression test for faulty logic

* Delete unused import

* Add migration

* Fix migrations

* Make the assertions check the intended behavior
2023-11-06 21:46:14 +01:00
lukinovec
73d7918170 Rename generateColumnName 2022-10-21 13:56:03 +02:00
lukinovec
5881f13b81 Correct comment 2022-10-21 11:51:05 +02:00
lukinovec
c0cd839acc Add test for generating the column name 2022-10-21 11:49:10 +02:00
j.stein
9b31176b32 Update VirtualColumnTest.php 2022-01-04 01:23:51 +01:00
j.stein
2ae1ed099f Sync with original attributes 2022-01-04 01:12:11 +01:00
Samuel Štancl
1418a51fef Initial commit 2020-07-06 14:25:02 +02:00