Completed
Push — master ( a36c27...010ee5 )
by GBProd
02:47
created

ClientRepository::newClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace GBProd\Tests\Units\ElasticsearchExtraBundle\Repository;
4
5
use atoum;
6
use mock\Elasticsearch\Client;
7
8
/**
9
 * Tests for ClientRepository
10
 * 
11
 * @author gbprod <[email protected]>
12
 */
13
class ClientRepository extends atoum
14
{
15 View Code Duplication
    public function testGetReturnsClient()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
    {
17
        $this
18
            ->given($clients = ['my_client' => $this->newClient()])
19
            ->and($this->newTestedInstance($clients))
20
            ->if($client = $this->testedInstance->get('my_client'))
21
            ->then
22
                ->object($client)
23
                    ->isIdenticalTo($clients['my_client'])
24
        ;
25
            
26
    }
27
    
28
    private function newClient()
29
    {
30
        $this->mockGenerator->shuntParentClassCalls();
31
        $this->mockGenerator->orphanize('__construct');
32
33
        return new Client();
34
    }
35
    
36 View Code Duplication
    public function testGetReturnsNullIfNotSets()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        $this
39
            ->given($clients = ['my_client' => $this->newClient()])
40
            ->and($this->newTestedInstance($clients))
41
            ->if($client = $this->testedInstance->get('not_a_client'))
42
            ->then
43
                ->variable($client)
44
                    ->isNull()
45
        ;
46
    }
47
}