snipe-it
snipe-it copied to clipboard
Bulk Edit Tests and Tweaks
Description
This introduces some bulk edit tests, includes some tweaks to factories, an extra gate, and the flipping of keys and values in an array.
The key value flip is because the array was originally
'id' => 'key'
but now is properly
'key' => 'id'
Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
These are tests. 😄
Test Configuration:
- PHP version: 8.1
- MySQL version: 8.2
PR Summary
- Improving Security and Rights Management in BulkAssetsController
- Security measures in the
BulkAssetsController.phphave been enhanced by adding new import statements, ensuring only administrators can modify certain sensitive data within the system. - The process of updating data has been optimized by using an existing array within the
updatemethod. - Removed redundant return comment.
- The clarity of the code has been improved by changing variable names to be more descriptive.
- New Method to Create Asset Models with Multiple Custom Fields
- Methods named
hasMultipleCustomFieldshave been added inAssetFactory.php,AssetModelFactory.php, andCustomFieldsetFactory.php, providing a way to easily create and manage different asset models with multiple custom fields, streamlining the modeling process and saving precious development time.
- Improving Code Clarity in Hardware View
- Changes in
hardware/bulk.blade.phphave been made to improve and simplify the code, making it easier to understand and maintain.
- Enhancement of Asset Bulk Editing Tests
- The
AssetsBulkEditTest.phpnow includes additional tests ranging from access rights management to verifying the correct behavior of the bulk editing functionality. - There are tests added to check if encrypted and unencrypted custom fields can be updated accurately and appropriately.
- Furthermore, the test coverage has enhanced to ensure that only admin users can update encrypted custom fields.
Each of these modifications contributes to improved system security, code quality, and test coverage, resulting in a more robust and reliable software.
Nice work!