Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve testing around company scoping #13211

Merged
merged 26 commits into from
Jun 28, 2023
Merged

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR mainly provides tests around scoping by company in order to support future changes to scoping functionality.


The test with the most interest is Tests\Unit\CompanyScopingTest since it checks to make sure the following models are directly scoped by company when Full Multiple Companies Support is enabled:

  • Accessory
  • Asset
  • Component
  • Consumable
  • License

In addition to the following related models:

  • AssetMaintenance through the Asset model
  • LicenseSeat through the License model

The actual code changes in this PR are focused in controllers and simply remove Company::scopeCompanyables where it is not needed because the models mentioned above use either the CompanyableTrait or CompanyableChildTrait which applies a query scope when the model is booted.

@what-the-diff
Copy link

what-the-diff bot commented Jun 26, 2023

PR Summary

  • Improved AssetsController and related files
    Removed Company::scopeCompanyables method and updated relevant code to improve efficiency.

  • Enhanced components, consumables, and licenses management
    Updated with method arguments and removed unnecessary methods to improve performance.

  • Added and updated test files
    Introduced new test files and modified existing ones to ensure comprehensive coverage.

  • Introduced CustomTestMacros and InteractsWithAuthentication
    Implemented custom test macros and authentication interactions for better testing capabilities.

  • Updated Settings and TestCase files
    Added methods to enable/disable multiple full company support and registered custom macros to enhance the testing environment.

  • Added CompanyScopingTest for better company management
    A new test class to verify the scoping of models based on company settings and scenarios for multiple companies.

@snipe snipe merged commit e1fdfd0 into snipe:develop Jun 28, 2023
@marcusmoore marcusmoore deleted the company-scoping branch June 28, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants