Completed
Push — master ( 8fac40...c170a7 )
by Kamil
42:58
created

ClientManagerSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 5 1
A it_is_initializable() 0 4 1
A it_extends_fos_oauth_server_client_manager() 0 4 1
A it_implements_fos_oauth_server_client_manager_interface() 0 4 1
A it_finds_client_by_public_id() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace spec\Sylius\Bundle\AdminApiBundle\Model;
13
14
use Doctrine\ORM\EntityManager;
15
use Doctrine\ORM\EntityRepository;
16
use FOS\OAuthServerBundle\Entity\ClientManager as FOSClientManager;
17
use FOS\OAuthServerBundle\Model\ClientInterface;
18
use FOS\OAuthServerBundle\Model\ClientManagerInterface;
19
use PhpSpec\ObjectBehavior;
20
use Sylius\Bundle\AdminApiBundle\Model\ClientManager;
21
22
final class ClientManagerSpec extends ObjectBehavior
23
{
24
    function let(EntityManager $em, EntityRepository $repository, $clientClass = 'Client/Class/String')
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $em. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
25
    {
26
        $em->getRepository($clientClass)->shouldBeCalled()->willReturn($repository);
27
        $this->beConstructedWith($em, $clientClass);
28
    }
29
30
    function it_is_initializable()
31
    {
32
        $this->shouldHaveType(ClientManager::class);
33
    }
34
35
    function it_extends_fos_oauth_server_client_manager()
36
    {
37
        $this->shouldHaveType(FOSClientManager::class);
38
    }
39
40
    function it_implements_fos_oauth_server_client_manager_interface()
41
    {
42
        $this->shouldImplement(ClientManagerInterface::class);
43
    }
44
45
    function it_finds_client_by_public_id(ClientInterface $client, $repository)
46
    {
47
        $repository->findOneBy(['randomId' => 'random_string'])->willReturn($client);
48
49
        $this->findClientByPublicId('random_string')->shouldReturn($client);
50
    }
51
}
52