mirror of
https://github.com/archtechx/virtualcolumn.git
synced 2025-12-12 12:54:04 +00:00
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>
This commit is contained in:
parent
925249bb72
commit
72de33a3d4
4 changed files with 216 additions and 108 deletions
20
phpunit.xml
20
phpunit.xml
|
|
@ -1,13 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd">
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<file>./src/routes.php</file>
|
||||
</exclude>
|
||||
</coverage>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd">
|
||||
<coverage/>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests</directory>
|
||||
|
|
@ -15,6 +8,7 @@
|
|||
</testsuites>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_KEY" value="base64:+osRhaqQtOcYM79fhVU8YdNBs/1iVJPWYUr9zvTPCs0="/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="redis"/>
|
||||
<env name="MAIL_DRIVER" value="array"/>
|
||||
|
|
@ -24,4 +18,12 @@
|
|||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="AWS_DEFAULT_REGION" value="us-west-2"/>
|
||||
</php>
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<file>./src/routes.php</file>
|
||||
</exclude>
|
||||
</source>
|
||||
</phpunit>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue