Kint_Object_InstanceTest::testSortByHierarchy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
class Kint_Object_InstanceTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Coding Style introduced by
Kint_Object_InstanceTest does not seem to conform to the naming convention (^[A-Z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
4
{
5
    public function testSortByHierarchy()
6
    {
7
        $this->assertEquals(1, Kint_Object_Instance::sortByHierarchy('TestClass', 'ChildTestClass'));
8
        $this->assertEquals(-1, Kint_Object_Instance::sortByHierarchy('ChildTestClass', 'TestClass'));
9
        $this->assertEquals(0, Kint_Object_Instance::sortByHierarchy('TestClass', 'TestClass'));
10
11
        $p = new Kint_Parser();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $p. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
12
        $b = Kint_Object::blank('$v');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $b. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
13
14
        $tc = new TestClass();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $tc. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
15
        $ctc = new ChildTestClass();
16
17
        $tc = $p->parse($tc, clone $b);
18
        $ctc = $p->parse($ctc, clone $b);
19
20
        $this->assertEquals(1, Kint_Object_Instance::sortByHierarchy($tc, $ctc));
21
        $this->assertEquals(-1, Kint_Object_Instance::sortByHierarchy($ctc, $tc));
22
        $this->assertEquals(0, Kint_Object_Instance::sortByHierarchy($tc, $tc));
23
    }
24
25
    public function testTransplant()
26
    {
27
        $p = new Kint_Parser();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $p. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
28
        $b = Kint_Object::blank('$v');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $b. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
29
        $v = new ChildTestClass();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $v. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
30
31
        $o = $p->parse($v, clone $b);
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $o. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
32
33
        $o2 = $o->transplant(new Kint_Object_Instance());
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $o2. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
34
35
        $o->hints[] = 'object';
36
37
        $this->assertEquals($o, $o2);
38
        $this->assertNotSame($o, $o2);
39
    }
40
41
    public function testGetType()
42
    {
43
        $p = new Kint_Parser();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $p. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
44
        $b = Kint_Object::blank('$v');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $b. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
45
        $v = new ChildTestClass();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $v. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
46
47
        $o = $p->parse($v, clone $b);
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $o. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
48
49
        $this->assertEquals('ChildTestClass', $o->getType());
50
    }
51
}
52