generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:spatie/laravel-ray
- Loading branch information
Showing
11 changed files
with
181 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,12 @@ jobs: | |
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/[email protected].1 | ||
uses: shivammathur/[email protected].4 | ||
with: | ||
php-version: 8.3 | ||
|
||
- name: Install composer dependencies | ||
uses: ramsey/composer-install@v2 | ||
uses: ramsey/composer-install@v3 | ||
|
||
- name: Run PHPStan | ||
run: vendor/bin/phpstan --error-format=github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ jobs: | |
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/[email protected].1 | ||
uses: shivammathur/[email protected].4 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: fileinfo, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelRay\Tests\Unit; | ||
|
||
use Illuminate\Support\Facades\Context; | ||
|
||
it('can send all context', function () { | ||
if (! contextSupported()) { | ||
return; | ||
} | ||
|
||
Context::add('key', 'value'); | ||
|
||
ray()->context(); | ||
|
||
expect($this->client->sentRequests())->toHaveCount(2); | ||
|
||
$requests = $this->client->sentRequests(); | ||
|
||
$clipboardData = $requests[0]['payloads'][0]['content']['meta']['0']['clipboard_data']; | ||
|
||
expect($clipboardData)->toContain('key', 'value'); | ||
}); | ||
|
||
|
||
it('can send specific context keys variadic', function () { | ||
if (! contextSupported()) { | ||
return; | ||
} | ||
|
||
Context::add('key1', 'value1'); | ||
Context::add('key2', 'value2'); | ||
Context::add('key3', 'value3'); | ||
|
||
ray()->context('key1', 'key3'); | ||
|
||
expect($this->client->sentRequests())->toHaveCount(2); | ||
|
||
$requests = $this->client->sentRequests(); | ||
|
||
$clipboardData = $requests[0]['payloads'][0]['content']['meta']['0']['clipboard_data']; | ||
|
||
expect($clipboardData)->toContain('key1', 'key3'); | ||
expect($clipboardData)->not()->toContain('key2'); | ||
}); | ||
|
||
it('can send specific context keys using an array', function () { | ||
if (! contextSupported()) { | ||
return; | ||
} | ||
|
||
Context::add('key1', 'value1'); | ||
Context::add('key2', 'value2'); | ||
Context::add('key3', 'value3'); | ||
|
||
ray()->context(['key1', 'key3']); | ||
|
||
expect($this->client->sentRequests())->toHaveCount(2); | ||
|
||
$requests = $this->client->sentRequests(); | ||
|
||
$clipboardData = $requests[0]['payloads'][0]['content']['meta']['0']['clipboard_data']; | ||
|
||
expect($clipboardData)->toContain('key1', 'key3'); | ||
expect($clipboardData)->not()->toContain('key2'); | ||
}); | ||
|
||
it('can send all hidden context', function () { | ||
if (! contextSupported()) { | ||
return; | ||
} | ||
|
||
Context::addHidden('hidden-key', 'hidden-value'); | ||
Context::add('visible-key', 'visible-value'); | ||
|
||
ray()->hiddenContext(); | ||
|
||
expect($this->client->sentRequests())->toHaveCount(2); | ||
|
||
$requests = $this->client->sentRequests(); | ||
|
||
$clipboardData = $requests[0]['payloads'][0]['content']['meta']['0']['clipboard_data']; | ||
|
||
expect($clipboardData)->toContain('hidden-key'); | ||
expect($clipboardData)->not()->toContain('visible-key'); | ||
}); |