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

IterableTest::provideIterables()   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\Iterable_
20
 */
21
class IterableTest extends TestCase
22
{
23
    /**
24
     * @covers ::__toString
25
     *
26
     * @dataProvider provideIterables
27
     */
28
    public function testIterableStringifyCorrectly(Iterable_ $iterable, string $expectedString) : void
29
    {
30
        $this->assertSame($expectedString, (string) $iterable);
31
    }
32
33
    public function provideIterables() : array
34
    {
35
        return [
36
            'simple iterable' => [new Iterable_(), 'iterable'],
37
            'iterable of mixed' => [new Iterable_(new Mixed_()), 'iterable'],
38
            'iterable of single type' => [new Iterable_(new String_()), 'iterable<string>'],
39
            'iterable of compound type' => [new Iterable_(new Compound([new Integer(), new String_()])), 'iterable<int|string>'],
40
            'iterable with key type' => [new Iterable_(new String_(), new Integer()), 'iterable<int,string>'],
41
        ];
42
    }
43
}
44