Completed
Push — master ( dbdf9d...5ad886 )
by Jaap
02:58 queued 10s
created

CollectionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCollectionStringifyCorrectly() 0 4 1
A provideCollections() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of phpDocumentor.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @link      http://phpdoc.org
12
 */
13
14
namespace phpDocumentor\Reflection\Types;
15
16
use phpDocumentor\Reflection\Fqsen;
17
use PHPUnit\Framework\TestCase;
18
19
/**
20
 * @coversDefaultClass \phpDocumentor\Reflection\Types\Collection
21
 */
22
class CollectionTest extends TestCase
23
{
24
    /**
25
     * @covers ::__toString
26
     *
27
     * @dataProvider provideCollections
28
     */
29
    public function testCollectionStringifyCorrectly(Collection $collection, string $expectedString) : void
30
    {
31
        $this->assertSame($expectedString, (string) $collection);
32
    }
33
34
    public function provideCollections() : array
35
    {
36
        return [
37
            'simple collection' => [new Collection(null, new Integer()), 'object<int>'],
38
            'simple collection with key type' => [new Collection(null, new Integer(), new String_()), 'object<string,int>'],
39
            'collection of single type using specific class' => [new Collection(new Fqsen('\Foo\Bar'), new Integer()), '\Foo\Bar<int>'],
40
            'collection of single type with key type and using specific class' => [new Collection(new Fqsen('\Foo\Bar'), new String_(), new Integer()), '\Foo\Bar<int,string>'],
41
        ];
42
    }
43
}
44