Completed
Push — develop ( ee92b8...9af8d2 )
by Jaap
03:41 queued 03:34
created

AssemblerAbstractTest::typeProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of phpDocumentor.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author    Mike van Riel <[email protected]>
9
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
10
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
11
 * @link      http://phpdoc.org
12
 *
13
 *
14
 */
15
16
namespace phpDocumentor\Descriptor\Builder\Reflector;
17
18
use phpDocumentor\Reflection\Type;
19
use phpDocumentor\Reflection\Types\Compound;
20
use phpDocumentor\Reflection\Types\Integer;
21
use phpDocumentor\Reflection\Types\String_;
22
use PHPUnit\Framework\TestCase;
23
24
class AssemblerAbstractTest extends TestCase
25
{
26
    /**
27
     * @param Type|null $type
28
     * @param string $expected
29
     * @dataProvider typeProvider
30
     */
31
    public function testDeduplicateTypes(?Type $type, string $expected)
32
    {
33
        $type = AssemblerAbstract::deduplicateTypes($type);
34
35
        self::assertEquals($expected, (string)$type);
36
    }
37
38
    public function typeProvider()
39
    {
40
        return [
41
            [
42
                new Compound([new String_(), new Integer()]),
43
                'string|int'
44
            ],
45
            [
46
                new Compound([new String_(), new String_()]),
47
                'string'
48
            ],
49
            [
50
                new String_(),
51
                'string'
52
            ],
53
54
        ];
55
    }
56
}
57