SimpleTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 34
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testCreateReturnsString() 0 8 1
A testIdIsAlwaysUnique() 0 11 2
1
<?php
2
3
namespace Pachico\SlimCorrelationId\Generator;
4
5
class SimpleTest extends \PHPUnit_Framework_TestCase
6
{
7
8
    /**
9
     * @var Simple
10
     */
11
    private $sut;
12
13
    public function setUp()
14
    {
15
        $this->sut = new Simple();
16
    }
17
18
    public function testCreateReturnsString()
19
    {
20
        // Act
21
        $id = $this->sut->create();
22
        // Assert
23
        $this->assertInternalType('string', $id);
24
        $this->assertSame(10, strlen($id));
25
    }
26
27
    public function testIdIsAlwaysUnique()
28
    {
29
        // Arrange
30
        $ids = [];
31
        for ($index = 0; $index < 100; $index++) {
32
            $ids[] = $this->sut->create();
33
        }
34
        $uniqueIds = array_unique($ids);
35
        // Assert
36
        $this->assertSame(100, count($uniqueIds));
37
    }
38
}
39