NSWDPC\Utilities\Cloudflare\Tests\MockCloudflarePurgeService
Synopsis
class MockCloudflarePurgeService
extends CloudflarePurgeService
implements
TestOnly
{
- // Inherited constants from CloudflarePurgeService
- const TYPE_HOST = 'Host';
- const TYPE_TAG = 'Tag';
- const TYPE_PREFIX = 'Prefix';
- const TYPE_URL = 'URL';
- const TYPE_ENTIRE = 'Entire';
- // members
- private static boolean $enabled = true;
- private static string $email = "test@example.com";
- private static string $auth_key = "test-123-abcd";
- private static string $base_url = '';
- private static string $zone_id = "test-zone";
- private static string $endpoint_base_uri = "";
- protected $adapter;
- // methods
- public MockCloudflareAdapter getSdkClient()
- public void getAdapter()
- // Inherited methods from CloudflarePurgeService
- public void __construct()
- protected CloudflareResult|null result()
- protected Guzzle getSdkClient()
- public CloudflareResult|null purgeAll()
- public CloudflareResult|false purgeTags()
- public CloudflareResult|false purgeHosts()
- public CloudflareResult|false purgeURLs()
- public CloudflareResult|false purgePrefixes()
- public static void getOptionForType()
- public static array getTypeMappings()
Hierarchy
Constants
Name | Value |
---|---|
TYPE_HOST | 'Host' |
TYPE_TAG | 'Tag' |
TYPE_PREFIX | 'Prefix' |
TYPE_URL | 'URL' |
TYPE_ENTIRE | 'Entire' |
Members
private
- $auth_key
- $base_url
- $enabled
- $endpoint_base_uri
- $zone_id
protected
- $adapter
Methods
public
- getAdapter()
- getSdkClient() — Retrieve a cloudflare/sdk client
Inherited from NSWDPC\Utilities\Cloudflare\CloudflarePurgeService
protected
- getSdkClient() — Retrieve a cloudflare/sdk client
- result()
public
- getOptionForType() — Get the option for the type
- getTypeMappings() — Map types to the options that can be provided to purge_cache API method called by cachePurge
- purgeAll() — Purge all from zone by creating a cache purge job in the future (which handles the purging) The idea here is that job will be created in the future with a configured delay (hrs) This allows job cancellation and manual actioning Only members with the permission ADMIN may create this job (in this method)
- purgeHosts() — Purge cache by hosts immediately using cloudflare/sdk
- purgePrefixes() — Have to do this directly via the Adapter for the moment
- purgeTags() — Purge cache by tags immediately using cloudflare/sdk
- purgeURLs() — Purge cache by urls immediately using cloudflare/sdk This method modifies the URLs provided to ensure they are absolute URLs