Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanzweifel committed Feb 13, 2024
1 parent 0744962 commit 1889ce0
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/Classifiers/MiddlewareClassifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Wnx\LaravelStats\Tests\Classifiers;

use Orchestra\Testbench\Attributes\DefineRoute;
use PHPUnit\Framework\Attributes\Test;
use Wnx\LaravelStats\Tests\TestCase;
use Wnx\LaravelStats\ReflectionClass;
use Illuminate\Routing\Middleware\ThrottleRequests;
Expand All @@ -10,13 +12,23 @@

class MiddlewareClassifierTest extends TestCase
{
/** @test */
public function it_returns_true_if_given_class_is_a_middleware()
/**
* Define routes setup.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
protected function usesMiddlewareRoutes($router)
{
if ($this->getLaravelVersion() === 11.0) {
$this->markTestSkipped("Middleware classification currently broken in Laravel 11.");
}
$router->get('/demo', function () {
return 'Hello World';
})->middleware(DemoMiddleware::class);
}

#[Test]
#[DefineRoute('usesMiddlewareRoutes')]
public function it_returns_true_if_given_class_is_a_middleware(): void
{
$this->assertTrue(
(new MiddlewareClassifier())->satisfies(
new ReflectionClass(DemoMiddleware::class)
Expand Down

0 comments on commit 1889ce0

Please sign in to comment.