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 ( 37c564...56f4ad )
by Mario
01:32
created

RegistryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 41.03 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 2
dl 16
loc 39
rs 10

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 Netgen\Bundle\OpenGraphBundle\Tests\Handler;
4
5
use Netgen\Bundle\OpenGraphBundle\Handler\HandlerInterface;
6
use Netgen\Bundle\OpenGraphBundle\Handler\Registry;
7
use PHPUnit\Framework\TestCase;
8
9
class RegistryTest extends TestCase
10
{
11
    /**
12
     * @var Registry
13
     */
14
    protected $registry;
15
16
    public function setUp()
17
    {
18
        $this->registry = new Registry();
19
    }
20
21
    public function testAddingHandlers()
22
    {
23
        $handler = $this->getMockForAbstractClass(HandlerInterface::class);
24
        $this->registry->addHandler('some_handler', $handler);
25
26
        $this->assertEquals($this->registry->getHandler('some_handler'), $handler);
27
    }
28
29
    public function testGettingHandlers()
30
    {
31
        $handler = $this->getMockForAbstractClass(HandlerInterface::class);
32
        $this->registry->addHandler('some_handler', $handler);
33
34
        $returnedHandler = $this->registry->getHandler('some_handler');
35
36
        $this->assertSame($handler, $returnedHandler);
37
    }
38
39
    /**
40
     * @expectedException  \Netgen\Bundle\OpenGraphBundle\Exception\HandlerNotFoundException
41
     * @expectedExceptionMessage Meta tag handler with 'some_handler' identifier not found.
42
     */
43
    public function testGettingNonExistentHandler()
44
    {
45
        $this->registry->getHandler('some_handler');
46
    }
47
}
48