File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,7 +104,6 @@ public function __construct(
104104 // Set up the dependencies
105105 if ($ cache ) {
106106 $ this ->setCacheHandler ($ cache );
107- $ this ->enableFeature ('caching ' );
108107 }
109108
110109 if ($ logger ) {
Original file line number Diff line number Diff line change @@ -68,6 +68,20 @@ public function test_caches_query_results_with_basic_caching(): void
6868 $ this ->assertCount (1 , $ results );
6969 }
7070
71+ public function test_cache_dependency_does_not_enable_caching_when_disabled_by_configuration (): void
72+ {
73+ $ this ->cache ->shouldNotReceive ('remember ' );
74+
75+ $ filter = new TestFilter ($ this ->request , $ this ->cache );
76+
77+ $ this ->assertFalse ($ filter ->hasFeature ('caching ' ));
78+
79+ $ filter ->apply ($ this ->builder );
80+ $ results = $ filter ->get ();
81+
82+ $ this ->assertInstanceOf (Collection::class, $ results );
83+ }
84+
7185 public function test_builds_appropriate_cache_key (): void
7286 {
7387 $ requestWithParams = Request::create ('/?name=John&status=active ' , 'GET ' );
Original file line number Diff line number Diff line change @@ -204,15 +204,17 @@ protected function validateFilterInputs(): void
204204 $ filter ->apply ($ this ->builder );
205205 }
206206
207- public function test_enables_features_by_constructor_dependencies (): void
207+ public function test_constructor_cache_dependency_respects_feature_defaults (): void
208208 {
209209 $ this ->cache ->shouldReceive ('remember ' )->andReturn (collect ());
210210
211211 // Create filter with cache and logger
212212 $ filter = new TestFilter ($ this ->request , $ this ->cache , $ this ->logger );
213213
214- // Verify features were enabled
215- $ this ->assertTrue ($ filter ->hasFeature ('caching ' ));
214+ // Cache should remain disabled unless explicitly enabled in configuration or code
215+ $ this ->assertFalse ($ filter ->hasFeature ('caching ' ));
216+
217+ // Logger injection still enables logging for compatibility with existing behavior
216218 $ this ->assertTrue ($ filter ->hasFeature ('logging ' ));
217219 }
218220
@@ -241,6 +243,7 @@ public function test_uses_cached_execution_when_caching_enabled(): void
241243
242244 // Create filter with cache
243245 $ filter = new TestFilter ($ this ->request , $ this ->cache );
246+ $ filter ->enableFeature ('caching ' );
244247
245248 // Verify caching is enabled
246249 $ this ->assertTrue ($ filter ->hasFeature ('caching ' ));
You can’t perform that action at this time.
0 commit comments