Completed
Push — master ( ee12eb...1b7bb6 )
by Ibrahim
03:01 queued 01:04
created

PlanTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 2
dl 26
loc 26
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
namespace Yabacon\Paystack\Tests\Routes;
3
4
use Yabacon\Paystack\Routes\Plan;
5
use Yabacon\Paystack\Contracts\RouteInterface;
6
7
class PlanTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testRoot()
10
    {
11
        $r = new Plan();
12
        $this->assertEquals('/plan', $r->root());
13
    }
14
15
    public function testEndpoints()
16
    {
17
        $r = new Plan();
18
        $this->assertEquals('/plan', $r->create()[RouteInterface::ENDPOINT_KEY]);
19
        $this->assertEquals('/plan', $r->getList()[RouteInterface::ENDPOINT_KEY]);
20
        $this->assertEquals('/plan/{id}', $r->fetch()[RouteInterface::ENDPOINT_KEY]);
21
        $this->assertEquals('/plan/{id}', $r->update()[RouteInterface::ENDPOINT_KEY]);
22
    }
23
    
24
    public function testMethods()
25
    {
26
        $r = new Plan();
27
        $this->assertEquals(RouteInterface::POST_METHOD, $r->create()[RouteInterface::METHOD_KEY]);
28
        $this->assertEquals(RouteInterface::GET_METHOD, $r->getList()[RouteInterface::METHOD_KEY]);
29
        $this->assertEquals(RouteInterface::GET_METHOD, $r->fetch()[RouteInterface::METHOD_KEY]);
30
        $this->assertEquals(RouteInterface::PUT_METHOD, $r->update()[RouteInterface::METHOD_KEY]);
31
    }
32
}
33