1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-26 02:52:30 +01:00
Pterodactyl-Panel/tests/Assertions/MiddlewareAttributeAssertionsTrait.php

35 lines
1012 B
PHP
Raw Normal View History

2017-11-02 02:45:43 +01:00
<?php
namespace Pterodactyl\Tests\Assertions;
2017-11-02 02:45:43 +01:00
use PHPUnit\Framework\Assert;
trait MiddlewareAttributeAssertionsTrait
{
/**
* Assert a request has an attribute assigned to it.
*/
public function assertRequestHasAttribute(string $attribute)
{
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)
{
Assert::assertFalse($this->request->attributes->has($attribute), 'Assert that request mock does not have ' . $attribute . ' attribute.');
}
/**
* Assert a request attribute matches an expected value.
*
2021-01-23 21:33:34 +01:00
* @param mixed $expected
2017-11-02 02:45:43 +01:00
*/
public function assertRequestAttributeEquals($expected, string $attribute)
{
Assert::assertEquals($expected, $this->request->attributes->get($attribute));
}
}