Completed
Pull Request — master (#36)
by Roman
04:41
created

GetReflectionFromRequestStepTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetRequiredArtifacts() 0 5 1
A testExecute() 0 9 1
1
<?php
2
3
namespace Kami\ApiCoreBundle\Tests\RequestProcessor\Step\Common;
4
5
use Kami\ApiCoreBundle\RequestProcessor\Step\Common\GetReflectionFromRequestStep;
6
use Kami\ApiCoreBundle\Tests\fixtures\Entity;
7
use Kami\Component\RequestProcessor\ArtifactCollection;
8
use PHPUnit\Framework\TestCase;
9
use Symfony\Component\HttpFoundation\ParameterBag;
10
use Symfony\Component\HttpFoundation\Request;
11
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
12
13
class GetReflectionFromRequestStepTest extends TestCase
14
{
15
16
    public function testExecute()
17
    {
18
        $request = new Request();
19
        $request->attributes->set('_entity', Entity::class);
20
        $step = new GetReflectionFromRequestStep();
21
22
        $artifacts = $step->execute($request);
23
        $this->assertInstanceOf(ArtifactCollection::class, $artifacts);
24
        $this->assertInstanceOf(\ReflectionClass::class, $artifacts->get('reflection')->getValue());
25
    }
26
27
    public function testGetRequiredArtifacts()
28
    {
29
        $step = new GetReflectionFromRequestStep();
30
31
        $this->assertEquals([], $step->getRequiredArtifacts());
32
    }
33
}
34