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

ArrayTest::provideArrays()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 PHPUnit\Framework\TestCase;
17
18
/**
19
 * @coversDefaultClass \phpDocumentor\Reflection\Types\Array_
20
 */
21
class ArrayTest extends TestCase
22
{
23
    /**
24
     * @covers ::__toString
25
     *
26
     * @dataProvider provideArrays
27
     */
28
    public function testArrayStringifyCorrectly(Array_ $array, string $expectedString) : void
29
    {
30
        $this->assertSame($expectedString, (string) $array);
31
    }
32
33
    public function provideArrays() : array
34
    {
35
        return [
36
            'simple array' => [new Array_(), 'array'],
37
            'array of mixed' => [new Array_(new Mixed_()), 'array'],
38
            'array of single type' => [new Array_(new String_()), 'string[]'],
39
            'array of compound type' => [new Array_(new Compound([new Integer(), new String_()])), '(int|string)[]'],
40
            'array with key type' => [new Array_(new String_(), new Integer()), 'array<int,string>'],
41
        ];
42
    }
43
}
44