Completed
Push — master ( 4a5840...1f0278 )
by
unknown
11s
created

WebhookListTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 53.85 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 14
loc 26
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetWebhookNoFilter() 0 7 1
A testGetWebhookPagination() 7 7 1
A testGetWebhookParams() 7 7 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 Moip\Tests\Resource;
4
5
use Moip\Helper\Pagination;
6
use Moip\Tests\TestCase;
7
8
class WebhookListTest extends TestCase
9
{
10
    public function testGetWebhookNoFilter()
11
    {
12
        $this->mockHttpSession($this->body_list_webhook_no_filter);
0 ignored issues
show
Bug introduced by
The property body_list_webhook_no_filter does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
        $webhooks = $this->moip->webhooks()->get();
14
15
        $this->assertNotEmpty($webhooks->getWebhooks());
16
    }
17
18 View Code Duplication
    public function testGetWebhookPagination()
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...
19
    {
20
        $this->mockHttpSession($this->body_list_webhook_pagination);
0 ignored issues
show
Bug introduced by
The property body_list_webhook_pagination does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
21
        $webhooks = $this->moip->webhooks()->get(new Pagination(100, 0));
22
23
        $this->assertNotEmpty($webhooks->getWebhooks());
24
    }
25
26 View Code Duplication
    public function testGetWebhookParams()
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...
27
    {
28
        $this->mockHttpSession($this->body_list_webhook_all_filters);
0 ignored issues
show
Bug introduced by
The property body_list_webhook_all_filters does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
29
        $webhooks = $this->moip->webhooks()->get(new Pagination(10, 0), 'ORD-EE5XP23RMLSS', 'ORDER.PAID');
30
31
        $this->assertNotEmpty($webhooks->getWebhooks());
32
    }
33
}
34