Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Aug 21, 2023
1 parent 3bde253 commit 26f7ff4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Pulse.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public function __construct(
*/
public function ignore($callback): mixed
{
$recording = $this->shouldRecord;
$recording = $this->shouldRecord;

$this->shouldRecord = false;
$this->shouldRecord = false;

try {
return $callback();
Expand Down
11 changes: 4 additions & 7 deletions tests/Feature/HandleExceptionTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?php

use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\AuthManager;
use Illuminate\Auth\GuardHelpers;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Auth\User;
Expand All @@ -13,13 +11,10 @@
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Schema;
use Laravel\Pulse\Facades\Pulse;
use Laravel\Pulse\Handlers\HandleException;
use Laravel\Pulse\Handlers\HandleQuery;
use Laravel\Pulse\Pulse as PulseInstance;

beforeEach(function () {
Expand Down Expand Up @@ -86,7 +81,8 @@

it('does not trigger an inifite loop when retriving the authenticated user from the database', function () {
Config::set('auth.guards.db', ['driver' => 'db']);
Auth::extend('db', fn () => new class implements Guard {
Auth::extend('db', fn () => new class implements Guard
{
use GuardHelpers;

public function validate(array $credentials = [])
Expand Down Expand Up @@ -119,7 +115,8 @@ public function user()
Facade::clearResolvedInstance(PulseInstance::class);
App::when(HandleException::class)
->needs(AuthManager::class)
->give(fn (Application $app) => new class($app) extends AuthManager {
->give(fn (Application $app) => new class($app) extends AuthManager
{
public function hasUser()
{
throw new RuntimeException('Error checking for user.');
Expand Down
9 changes: 4 additions & 5 deletions tests/Feature/HandleQueryTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\AuthManager;
use Illuminate\Auth\GuardHelpers;
use Illuminate\Contracts\Auth\Guard;
Expand All @@ -13,9 +12,7 @@
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Schema;
use Laravel\Pulse\Facades\Pulse;
use Laravel\Pulse\Handlers\HandleQuery;
Expand Down Expand Up @@ -125,7 +122,8 @@

it('does not trigger an inifite loop when retriving the authenticated user from the database', function () {
Config::set('auth.guards.db', ['driver' => 'db']);
Auth::extend('db', fn () => new class implements Guard {
Auth::extend('db', fn () => new class implements Guard
{
use GuardHelpers;

public function validate(array $credentials = [])
Expand Down Expand Up @@ -158,7 +156,8 @@ public function user()
Facade::clearResolvedInstance(PulseInstance::class);
App::when(HandleQuery::class)
->needs(AuthManager::class)
->give(fn (Application $app) => new class($app) extends AuthManager {
->give(fn (Application $app) => new class($app) extends AuthManager
{
public function hasUser()
{
throw new RuntimeException('Error checking for user.');
Expand Down
3 changes: 2 additions & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
|
*/

function prependListener(string $event, callable $listener): void {
function prependListener(string $event, callable $listener): void
{
$listeners = Event::getRawListeners()[$event];

Event::forget($event);
Expand Down

0 comments on commit 26f7ff4

Please sign in to comment.