Files
pterodactyl-panel/tests/Assertions/MiddlewareAttributeAssertionsTrait.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

35 lines
1017 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Tests\Assertions;
use PHPUnit\Framework\Assert;
trait MiddlewareAttributeAssertionsTrait
{
/**
* Assert a request has an attribute assigned to it.
*/
public function assertRequestHasAttribute(string $attribute): void
{
Assert::assertTrue($this->request->attributes->has($attribute), 'Assert that request mock has '.$attribute.' attribute.');
}
/**
* Assert a request does not have an attribute assigned to it.
*/
public function assertRequestMissingAttribute(string $attribute): void
{
Assert::assertFalse($this->request->attributes->has($attribute), 'Assert that request mock does not have '.$attribute.' attribute.');
}
/**
* Assert a request attribute matches an expected value.
*/
public function assertRequestAttributeEquals(mixed $expected, string $attribute): void
{
Assert::assertEquals($expected, $this->request->attributes->get($attribute));
}
}