Completed
Push — master ( 5e935f...1adcc0 )
by dan
01:52
created

DatabaseNotificationManagerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testCreateDatabaseNotification() 0 12 1
1
<?php
2
3
namespace IrishDan\NotificationBundle\Test;
4
5
use IrishDan\NotificationBundle\DatabaseNotificationManager;
6
7
class DatabaseNotificationManagerTest extends NotificationTestCase
8
{
9
    protected $databaseNotificationManager;
10
    protected $entityManager;
11
    protected $managerRegistry;
12
13
    public function setUp()
14
    {
15
        $this->managerRegistry = $this->getService('doctrine');
16
        $this->databaseNotificationManager = new DatabaseNotificationManager($this->managerRegistry, [
17
            'entity' => 'Notification:Test\Notification',
18
        ]);
19
    }
20
21
    public function testCreateDatabaseNotification()
22
    {
23
        $data = [
0 ignored issues
show
Unused Code introduced by
$data is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
24
            'title' => 'Test title',
25
            'body' => 'Test body',
26
            'uuid' => '12346789',
27
            'type' => 'AppBundle\Notification\TestNotification',
28
        ];
29
30
        // $databaseNotification = $this->databaseNotificationManager->createDatabaseNotification($data);
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
31
        // $this->assertFalse($databaseNotification);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
32
    }
33
}