- Notifications
You must be signed in to change notification settings - Fork 8
Feature Fix #194
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
Merged
Merged
Feature Fix #194
Changes from 1 commit
Commits
Show all changes
6 commits Select commit Hold shift + click to select a range
01e6066 wip
StanBarrows d88dcb1 wip
StanBarrows 3c42967 Update CHANGELOG.md
StanBarrows 62dba58 Laravel 12 compatibility issues, Updated readme.md and fixed tests
StanBarrows 78524c6 Merge branch 'feature-fix' of github.com:codebar-ag/laravel-docuware …
StanBarrows d026abf wip
StanBarrows File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| <?php | ||
| | ||
| test('cache configuration uses CACHE_STORE in Laravel 12', function () { | ||
| // Mock the configuration to simulate Laravel 12 with CACHE_STORE | ||
| config([ | ||
| 'laravel-docuware.configurations.cache.driver' => 'redis', | ||
| ]); | ||
| | ||
| // Test that the configuration is properly loaded | ||
| $cacheDriver = config('laravel-docuware.configurations.cache.driver'); | ||
| expect($cacheDriver)->toBe('redis'); | ||
| }); | ||
| | ||
| test('cache configuration falls back to CACHE_DRIVER when CACHE_STORE is not set', function () { | ||
| // Mock the configuration to simulate older Laravel versions | ||
| config([ | ||
| 'laravel-docuware.configurations.cache.driver' => 'file', | ||
| ]); | ||
| | ||
| // Test that the configuration is properly loaded | ||
| $cacheDriver = config('laravel-docuware.configurations.cache.driver'); | ||
| expect($cacheDriver)->toBe('file'); | ||
| }); | ||
| | ||
| test('cache configuration uses DOCUWARE_CACHE_DRIVER when explicitly set', function () { | ||
| // Mock the configuration to prioritize DOCUWARE_CACHE_DRIVER | ||
| config([ | ||
| 'laravel-docuware.configurations.cache.driver' => 'array', | ||
| ]); | ||
| | ||
| // Test that the configuration is properly loaded | ||
| $cacheDriver = config('laravel-docuware.configurations.cache.driver'); | ||
| expect($cacheDriver)->toBe('array'); | ||
| }); | ||
| | ||
| test('cache configuration respects the new CACHE_STORE fallback chain', function () { | ||
| // Test that the configuration properly uses the new fallback chain: | ||
| // DOCUWARE_CACHE_DRIVER -> CACHE_STORE -> CACHE_DRIVER -> 'file' | ||
| | ||
| // Mock the configuration to simulate the fallback chain | ||
| config([ | ||
| 'laravel-docuware.configurations.cache.driver' => 'redis', // This would be set by CACHE_STORE | ||
| ]); | ||
| | ||
| // Test that the configuration is properly loaded | ||
| $cacheDriver = config('laravel-docuware.configurations.cache.driver'); | ||
| expect($cacheDriver)->toBe('redis'); | ||
| }); | ||
| | ||
| test('cache configuration uses default file driver when no configuration is set', function () { | ||
| // Reset the configuration to test default behavior | ||
| config([ | ||
| 'laravel-docuware.configurations.cache.driver' => 'file', | ||
| ]); | ||
| | ||
| // Test that the configuration is properly loaded | ||
| $cacheDriver = config('laravel-docuware.configurations.cache.driver'); | ||
| expect($cacheDriver)->toBe('file'); | ||
| }); | ||
| | ||
| test('environment variable fallback chain works correctly', function () { | ||
| // Test that the environment variable fallback chain works as expected | ||
| // This simulates the actual configuration loading logic | ||
| | ||
| // Mock the environment variables | ||
| putenv('DOCUWARE_CACHE_DRIVER=array'); | ||
| putenv('CACHE_STORE=redis'); | ||
| putenv('CACHE_DRIVER=file'); | ||
| | ||
| // The configuration should prioritize DOCUWARE_CACHE_DRIVER | ||
| $expectedDriver = env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', env('CACHE_DRIVER', 'file'))); | ||
| expect($expectedDriver)->toBe('array'); | ||
| | ||
| // Clean up | ||
| putenv('DOCUWARE_CACHE_DRIVER'); | ||
| putenv('CACHE_STORE'); | ||
| putenv('CACHE_DRIVER'); | ||
| }); | ||
| | ||
| test('CACHE_STORE takes precedence over CACHE_DRIVER when DOCUWARE_CACHE_DRIVER is not set', function () { | ||
| // Mock the environment variables | ||
| putenv('DOCUWARE_CACHE_DRIVER='); | ||
| putenv('CACHE_STORE=redis'); | ||
| putenv('CACHE_DRIVER=file'); | ||
| | ||
| // The configuration should use CACHE_STORE when DOCUWARE_CACHE_DRIVER is not set | ||
| $expectedDriver = env('DOCUWARE_CACHE_DRIVER', env('CACHE_STORE', env('CACHE_DRIVER', 'file'))); | ||
| expect($expectedDriver)->toBe('redis'); | ||
| | ||
| // Clean up | ||
| putenv('DOCUWARE_CACHE_DRIVER'); | ||
| putenv('CACHE_STORE'); | ||
| putenv('CACHE_DRIVER'); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.