@@ -132,7 +132,6 @@ public function test_read_non_existent_config_file() {
132132 $ method ->invoke ($ config );
133133 }
134134
135-
136135 public function test_generate_store_instance_config () {
137136 // Directly create a config.
138137 $ config = new \tool_forcedcache_cache_config ();
@@ -153,20 +152,42 @@ public function test_generate_store_instance_config() {
153152 // Now test with 0 stores declared and confirm its just the defaults.
154153 $ this ->assertEquals ($ storezero ['expected ' ], $ method ->invoke ($ config , $ storezero ['input ' ]));
155154
155+ // Now test store with where store isn't ready, don't instantiate (APCu doesn't work from CLI).
156+ $ this ->assertEquals ($ storereqsnotmet ['expected ' ], $ method ->invoke ($ config , $ storereqsnotmet ['input ' ]));
157+ }
158+
159+ public function test_generate_store_instance_config_badtype () {
160+ // Directly create a config.
161+ $ config = new \tool_forcedcache_cache_config ();
162+
163+ // Setup reflection for private function.
164+ $ method = new \ReflectionMethod ($ config , 'generate_store_instance_config ' );
165+ $ method ->setAccessible (true );
166+
167+ // Read in the fixtures file for data.
168+ include (__DIR__ . '/fixtures/stores_data.php ' );
169+
156170 // Now test a store with a bad type.
157171 $ this ->expectException (\cache_exception::class);
158172 $ this ->expectExceptionMessage (get_string ('store_bad_type ' , 'tool_forcedcache ' , 'faketype ' ));
159173 $ storearr1 = $ method ->invoke ($ config , $ storebadtype ['input ' ]);
160- $ this ->assertNull ($ storearr1 );
174+ }
175+
176+ public function test_generate_store_instance_config_missingfield () {
177+ // Directly create a config.
178+ $ config = new \tool_forcedcache_cache_config ();
179+
180+ // Setup reflection for private function.
181+ $ method = new \ReflectionMethod ($ config , 'generate_store_instance_config ' );
182+ $ method ->setAccessible (true );
183+
184+ // Read in the fixtures file for data.
185+ include (__DIR__ . '/fixtures/stores_data.php ' );
161186
162187 // Now test a store with a missing required field.
163188 $ this ->expectException (\cache_exception::class);
164- $ this ->expectExceptionMessage (get_string ('store_missing_fields ' , 'tool_forcedcache ' , 'apcu-test ' ));
165- $ storearr1 = $ method ->invoke ($ config , $ storemissingfields ['input ' ]);
166- $ this ->assertNull ($ storearr1 );
167-
168- // Now test store with where store isn't ready, don't instantiate (APCu doesn't work from CLI).
169- $ this ->assertEquals ($ storereqsnotmet ['expected ' ], $ method ->invoke ($ config , $ storereqsnotmet ['input ' ]));
189+ $ this ->expectExceptionMessage (get_string ('store_missing_fields ' , 'tool_forcedcache ' , 'apcutest ' ));
190+ $ storearr1 = $ method ->invoke ($ config , $ storemissingfield ['input ' ]);
170191 }
171192
172193 /**
0 commit comments