Completed
Push — master ( 1978d2...e2f699 )
by William
03:55
created

SymfonyContainerResolverTest::test()   A

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 21
Code Lines 14

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3143
cc 1
eloc 14
nc 1
nop 0
1
<?php
2
3
namespace Hateoas\Tests\Configuration\Provider\Resolver;
4
5
use Hateoas\Configuration\RelationProvider as RelationProviderConfiguration;
6
use Hateoas\Configuration\Provider\Resolver\SymfonyContainerResolver;
7
use Hateoas\Tests\TestCase;
8
9
class SymfonyContainerResolverTest extends TestCase
10
{
11
    public function test()
12
    {
13
        $object = new \StdClass();
14
        $service = new \StdClass();
15
16
        $containerProphecy = $this->prophesize('Symfony\Component\DependencyInjection\ContainerInterface');
17
        $containerProphecy
18
            ->get('acme.foo_service')
19
            ->willReturn($service)
20
        ;
21
22
        $providerProvider = new SymfonyContainerResolver($containerProphecy->reveal());
23
24
        $this->assertNull($providerProvider->getRelationProvider(new RelationProviderConfiguration('!-;'), $object));
25
        $this->assertNull($providerProvider->getRelationProvider(new RelationProviderConfiguration('getSomething'), $object));
26
        $this->assertNull($providerProvider->getRelationProvider(new RelationProviderConfiguration('foo::bar'), $object));
27
        $this->assertSame(
28
            [$service, 'method'],
29
            $providerProvider->getRelationProvider(new RelationProviderConfiguration('acme.foo_service:method'), $object)
30
        );
31
    }
32
}
33