infinito/application/symfony/tests/Unit/Attribut/RequestAttributTest.php

40 lines
953 B
PHP
Raw Normal View History

2019-01-27 11:15:07 +01:00
<?php
namespace Tests\Unit\Attribut;
use PHPUnit\Framework\TestCase;
use Infinito\Attribut\RequestAttributInterface;
use Infinito\Attribut\RequestAttribut;
2019-01-27 11:15:07 +01:00
use Symfony\Component\HttpFoundation\Request;
/**
* @author kevinfrantz
*/
class RequestAttributTest extends TestCase
{
/**
* @var RequestAttributInterface
*/
protected $requestAttribut;
public function setUp(): void
{
$this->requestAttribut = new class() implements RequestAttributInterface {
use RequestAttribut;
};
}
public function testConstruct(): void
{
$this->expectException(\TypeError::class);
$this->requestAttribut->getRequest();
}
public function testAccessors(): void
{
$request = $this->createMock(Request::class);
$this->assertNull($this->requestAttribut->setRequest($request));
$this->assertEquals($request, $this->requestAttribut->getRequest());
}
}