GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0c8f9f...37376a )
by Nicolas
02:44 queued 59s
created

MeasureManagerSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 25.58 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 0
cbo 3
dl 11
loc 43
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 11 11 2
A it_throws_an_exception_when_try_to_get_symbols_of_unknown_family() 0 8 1
A it_returns_unit_symbols_list_from_a_family() 0 12 1
A it_returns_standard_unit_for_a_family() 0 6 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 spec\Akeneo\Bundle\MeasureBundle\Manager;
4
5
use Akeneo\Bundle\MeasureBundle\Family\WeightFamilyInterface;
6
use PhpSpec\ObjectBehavior;
7
use Symfony\Component\Yaml\Yaml;
8
9
/**
10
 *
11
 * @author    Romain Monceau <[email protected]>
12
 * @copyright 2014 Akeneo SAS (http://www.akeneo.com)
13
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
class MeasureManagerSpec extends ObjectBehavior
16
{
17 View Code Duplication
    function let()
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...
18
    {
19
        $filename = realpath(dirname(__FILE__) .'/../Resources/config/measure-test.yml');
20
        if (!file_exists($filename)) {
21
            throw new \Exception(sprintf('Config file "%s" does not exist', $filename));
22
        }
23
24
        $config = Yaml::parse(file_get_contents($filename));
25
26
        $this->setMeasureConfig($config['measures_config']);
27
    }
28
29
    function it_throws_an_exception_when_try_to_get_symbols_of_unknown_family()
30
    {
31
        $this
32
            ->shouldThrow(
33
                new \InvalidArgumentException('Undefined measure family "foo"')
34
            )
35
            ->during('getUnitSymbolsForFamily', array('foo'));
36
    }
37
38
    function it_returns_unit_symbols_list_from_a_family()
39
    {
40
        $this
41
            ->getUnitSymbolsForFamily(WeightFamilyInterface::FAMILY)
42
            ->shouldReturn(
43
                array(
44
                    'MILLIGRAM' => 'mg',
45
                    'GRAM' => 'g',
46
                    'KILOGRAM' => 'kg'
47
                )
48
            );
49
    }
50
51
    function it_returns_standard_unit_for_a_family()
52
    {
53
        $this
54
            ->getStandardUnitForFamily(WeightFamilyInterface::FAMILY)
55
            ->shouldReturn(WeightFamilyInterface::GRAM);
56
    }
57
}
58