Skip to content

Commit

Permalink
add assign to tolerated words
Browse files Browse the repository at this point in the history
  • Loading branch information
JonPurvis committed Aug 7, 2024
1 parent 393dc44 commit 4fd06c9
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Config/tolerated.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
'start',
'object',
'parse',
'password'
'password',
'assign'
];
2 changes: 2 additions & 0 deletions src/Expectations/Profanity.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ function (ObjectDescription $object) use (&$foundWords, $excluding, $including):

$foundWords = array_filter($words, fn ($word): bool => preg_match('/'.preg_quote($word, '/').'/i', $fileContents) === 1);

dd($foundWords);

return $foundWords === [];

Check failure on line 30 in src/Expectations/Profanity.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-stable)

Unreachable statement - code above always terminates.

Check failure on line 30 in src/Expectations/Profanity.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Unreachable statement - code above always terminates.

Check failure on line 30 in src/Expectations/Profanity.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Unreachable statement - code above always terminates.
},
'to not use profanity',
Expand Down
63 changes: 59 additions & 4 deletions tests/Fixtures/HasNoProfanity.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,63 @@

class HasNoProfanity
{
public function __construct(
public string $name,
public string $description,
) {}
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];

/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],

'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class . ':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

/**
* The application's middleware aliases.
*
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

0 comments on commit 4fd06c9

Please sign in to comment.