Completed
Pull Request — master (#14)
by Pavel
03:24
created

IndirectFieldsTestAbstract   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 86.96 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 20
loc 23
c 0
b 0
f 0
wmc 1
lcom 1
cbo 5
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testIndirectId() 20 20 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Bankiru\Api\Doctrine\Tests;
4
5
use Bankiru\Api\Doctrine\Test\Entity\IndirectIdEntity;
6
7
class IndirectFieldsTestAbstract extends AbstractEntityManagerTest
8
{
9 View Code Duplication
    public function testIndirectId()
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...
10
    {
11
        $repository = $this->getManager()->getRepository(IndirectIdEntity::class);
12
        $this->getClient()->push(
13
            $this->getResponseMock(
14
                true,
15
                (object)[
16
                    'some-long-api-field-name' => 241,
17
                    'payload'                  => 'test',
18
                ]
19
            )
20
        );
21
22
        /** @var IndirectIdEntity $entity */
23
        $entity = $repository->find(241);
24
25
        self::assertInstanceOf(IndirectIdEntity::class, $entity);
26
        self::assertEquals(241, $entity->getId());
27
        self::assertEquals('test', $entity->getPayload());
28
    }
29
}
30