'https://api-eu.dhl.com', 'api_key' => 'cached-api-key', 'username' => 'cached-user', 'password' => 'cached-password', 'account_numbers' => ['V01PAK' => '63144073550101'], ]; $reflection = new ReflectionClass(SettingController::class); $property = $reflection->getProperty('cachedDhlConfig'); $property->setAccessible(true); $property->setValue(null, $cached); $controller = new SettingController; expect($controller->getDhlConfig())->toBe($cached); $secondCall = $controller->getDhlConfig(); expect($secondCall)->toBe($cached); }); it('flushes the DHL configuration cache on demand', function () { $reflection = new ReflectionClass(SettingController::class); $property = $reflection->getProperty('cachedDhlConfig'); $property->setAccessible(true); $property->setValue(null, ['api_key' => 'cached-api-key']); expect($property->getValue())->toBe(['api_key' => 'cached-api-key']); SettingController::flushDhlConfigCache(); expect($property->getValue())->toBeNull(); });