Completed
Push — develop ( 5df781...b9059c )
by Oyebanji Jacob
02:09
created

ModelTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 59.26 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A testGetTableNameReturnsCorrectTableName() 8 8 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
use Pyjac\ORM\Model;
4
5
class ModelTest extends PHPUnit_Framework_TestCase
6
{
7
	protected $model;
8
9
	public function setUp(){
10
		$this->model =  $this->getMockForAbstractClass('Pyjac\ORM\Model');
11
	}
12
13 View Code Duplication
	public function testGetTableNameReturnsCorrectTableName()
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...
14
    {
15
        $this->model->expects($this->any())
16
             ->method('getTableName')
17
             ->will($this->returnValue(strtolower(get_class($stub).'s')));
0 ignored issues
show
Bug introduced by
The variable $stub does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
18
19
        $this->assertEquals($stub->getTableName(), strtolower(get_class($stub).'s'));
20
    }
21
22 View Code Duplication
    public function testGetTableNameReturnsCorrectTableName()
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...
23
    {
24
        $this->model->expects($this->any())
25
             ->method('getTableName')
26
             ->will($this->returnValue(strtolower(get_class($stub).'s')));
0 ignored issues
show
Bug introduced by
The variable $stub does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
27
28
        $this->assertEquals($stub->getTableName(), strtolower(get_class($stub).'s'));
29
    }
30
31
}