@@ -134,7 +134,6 @@ public function test_read_non_existent_config_file() {
134134 $ method ->invoke ($ config );
135135 }
136136
137-
138137 public function test_generate_store_instance_config () {
139138 // Directly create a config.
140139 $ config = new \tool_forcedcache_cache_config ();
@@ -155,20 +154,44 @@ public function test_generate_store_instance_config() {
155154 // Now test with 0 stores declared and confirm its just the defaults.
156155 $ this ->assertEquals ($ storezero ['expected ' ], $ method ->invoke ($ config , $ storezero ['input ' ]));
157156
157+ // Now test store with where store isn't ready, don't instantiate (APCu doesn't work from CLI).
158+ $ this ->assertEquals ($ storereqsnotmet ['expected ' ], $ method ->invoke ($ config , $ storereqsnotmet ['input ' ]));
159+ }
160+
161+ public function test_generate_store_instance_config_badtype () {
162+ // Directly create a config.
163+ $ config = new \tool_forcedcache_cache_config ();
164+
165+ // Setup reflection for private function.
166+ $ method = new \ReflectionMethod ($ config , 'generate_store_instance_config ' );
167+ $ method ->setAccessible (true );
168+
169+ // Read in the fixtures file for data.
170+ include (__DIR__ . '/fixtures/stores_data.php ' );
171+
158172 // Now test a store with a bad type.
159173 $ this ->expectException (\cache_exception::class);
160174 $ this ->expectExceptionMessage (get_string ('store_bad_type ' , 'tool_forcedcache ' , 'faketype ' ));
161175 $ storearr1 = $ method ->invoke ($ config , $ storebadtype ['input ' ]);
162176 $ this ->assertNull ($ storearr1 );
177+ }
178+
179+ public function test_generate_store_instance_config_missingfield () {
180+ // Directly create a config.
181+ $ config = new \tool_forcedcache_cache_config ();
182+
183+ // Setup reflection for private function.
184+ $ method = new \ReflectionMethod ($ config , 'generate_store_instance_config ' );
185+ $ method ->setAccessible (true );
186+
187+ // Read in the fixtures file for data.
188+ include (__DIR__ . '/fixtures/stores_data.php ' );
163189
164190 // Now test a store with a missing required field.
165191 $ this ->expectException (\cache_exception::class);
166- $ this ->expectExceptionMessage (get_string ('store_missing_fields ' , 'tool_forcedcache ' , 'apcu-test ' ));
167- $ storearr1 = $ method ->invoke ($ config , $ storemissingfields ['input ' ]);
192+ $ this ->expectExceptionMessage (get_string ('store_missing_fields ' , 'tool_forcedcache ' , 'apcutest ' ));
193+ $ storearr1 = $ method ->invoke ($ config , $ storemissingfield ['input ' ]);
168194 $ this ->assertNull ($ storearr1 );
169-
170- // Now test store with where store isn't ready, don't instantiate (APCu doesn't work from CLI).
171- $ this ->assertEquals ($ storereqsnotmet ['expected ' ], $ method ->invoke ($ config , $ storereqsnotmet ['input ' ]));
172195 }
173196
174197 /**
0 commit comments