diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 79064b9..a505489 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -36,7 +36,7 @@ jobs: php-version: ${{ matrix.php }} extensions: dom, curl, libxml, mbstring, zip tools: composer:v2 - coverage: none + coverage: xdebug - name: Setup problem matchers run: | @@ -52,4 +52,4 @@ jobs: run: composer show -D - name: Execute tests - run: vendor/bin/pest --ci + run: vendor/bin/pest --ci --coverage diff --git a/src/Connectors/PlausibleConnector.php b/src/Connectors/PlausibleConnector.php index 649051c..b55c41d 100644 --- a/src/Connectors/PlausibleConnector.php +++ b/src/Connectors/PlausibleConnector.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Cache; use Saloon\CachePlugin\Traits\HasCaching; +use Saloon\Http\Auth\TokenAuthenticator; use Saloon\Http\Connector; use Saloon\CachePlugin\Contracts\Driver; use Saloon\CachePlugin\Drivers\LaravelCacheDriver; @@ -13,9 +14,16 @@ class PlausibleConnector extends Connector implements Cacheable { use HasCaching; + protected ?string $token; + public function __construct() { - $this->withTokenAuth(token: config(key: 'plausible.api_key')); + $this->token = config(key: 'plausible.api_key'); + } + + protected function defaultAuth(): TokenAuthenticator + { + return new TokenAuthenticator($this->token); } public function resolveBaseUrl(): string