snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Bulk Edit Tests and Tweaks

Open spencerrlongg opened this issue 1 year ago • 1 comments

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

spencerrlongg avatar May 09 '24 20:05 spencerrlongg

PR Summary

  • Improving Security and Rights Management in BulkAssetsController
  • Security measures in the BulkAssetsController.php have 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 update method.
  • 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 hasMultipleCustomFields have been added in AssetFactory.php, AssetModelFactory.php, and CustomFieldsetFactory.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.php have been made to improve and simplify the code, making it easier to understand and maintain.
  • Enhancement of Asset Bulk Editing Tests
  • The AssetsBulkEditTest.php now 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.

what-the-diff[bot] avatar May 09 '24 20:05 what-the-diff[bot]

Nice work!

snipe avatar May 15 '24 10:05 snipe