ValuesCollectionTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCollection() 0 19 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Petrica
5
 * Date: 3/30/2016
6
 * Time: 23:06
7
 */
8
namespace Petrica\StatsdSystem\Tests\Collection;
9
10
use Petrica\StatsdSystem\Collection\ValuesCollection;
11
12
class ValuesCollectionTest extends \PHPUnit_Framework_TestCase
13
{
14
    public function testCollection()
15
    {
16
        $collection = new ValuesCollection(array('test'));
17
        $collection->add('another', 1);
18
        $collection->offsetSet('offset', 10);
19
        $collection->offsetSet('missing', 5);
20
        $collection->offsetUnset('missing');
21
22
        $expected = array('test', 'another' => 1, 'offset' => 10);
23
24
        $iterator = new \ArrayIterator($expected);
25
26
        $this->assertEquals($expected, $collection->getValues());
27
        $this->assertEquals($iterator, $collection->getIterator());
28
        $this->assertEquals(3, $collection->count());
29
        $this->assertTrue($collection->offsetExists('another'));
30
        $this->assertFalse($collection->offsetExists('not_exist'));
31
        $this->assertEquals('test', $collection->offsetGet(0));
32
    }
33
}