-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathChainedAttributePresenterTest.php
43 lines (35 loc) · 1.27 KB
/
ChainedAttributePresenterTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @copyright Marco Bunge <[email protected]>
*/
namespace Mbunge\PhpAttributes\Tests\Unit\Presenter;
use Mbunge\PhpAttributes\Presenter\AttributePresenterInterface;
use Mbunge\PhpAttributes\Presenter\ChainedAttributePresenter;
use Mbunge\PhpAttributes\Resolver\ResolvedAttributeDto;
use Mbunge\PhpAttributes\Tests\TestAttributeStub;
use Mbunge\PhpAttributes\Tests\TestStub;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
/**
* Class ChainedAttributePresenterTest
* @package Mbunge\PhpAttributes\Tests\Unit\Presenter
* @copyright Marco Bunge <[email protected]>
*/
class ChainedAttributePresenterTest extends TestCase
{
public function testPresent()
{
$dtoMock = new ResolvedAttributeDto(new TestAttributeStub('a'), new ReflectionClass(TestStub::class));
$presenterMock = $this->createMock(AttributePresenterInterface::class);
$presenterMock
->method('present')->willReturn($dtoMock);
$presenters = [
$presenterMock,
$presenterMock
];
$resolver = new ChainedAttributePresenter($presenters);
$result = $resolver->present([$dtoMock]);
$this->assertCount(2, $result);
$this->assertContainsOnlyInstancesOf(ResolvedAttributeDto::class, $result);
}
}