|  | 
|  | 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\PseudoTypes; | 
|  | 15 | + | 
|  | 16 | +use phpDocumentor\Reflection\Types\Compound; | 
|  | 17 | +use phpDocumentor\Reflection\Types\Integer; | 
|  | 18 | +use phpDocumentor\Reflection\Types\Mixed_; | 
|  | 19 | +use phpDocumentor\Reflection\Types\String_; | 
|  | 20 | +use PHPUnit\Framework\TestCase; | 
|  | 21 | + | 
|  | 22 | +/** | 
|  | 23 | + * @coversDefaultClass \phpDocumentor\Reflection\PseudoTypes\NonEmptyArray | 
|  | 24 | + */ | 
|  | 25 | +class NonEmptyArrayTest extends TestCase | 
|  | 26 | +{ | 
|  | 27 | +    /** | 
|  | 28 | +     * @dataProvider provideArrays | 
|  | 29 | +     * @covers ::__toString | 
|  | 30 | +     */ | 
|  | 31 | +    public function testArrayStringifyCorrectly(NonEmptyArray $array, string $expectedString): void | 
|  | 32 | +    { | 
|  | 33 | +        $this->assertSame($expectedString, (string) $array); | 
|  | 34 | +    } | 
|  | 35 | + | 
|  | 36 | +    /** | 
|  | 37 | +     * @return mixed[] | 
|  | 38 | +     */ | 
|  | 39 | +    public function provideArrays(): array | 
|  | 40 | +    { | 
|  | 41 | +        return [ | 
|  | 42 | +            'simple non-empty-array' => [new NonEmptyArray(), 'non-empty-array'], | 
|  | 43 | +            'non-empty-array of mixed' => [new NonEmptyArray(new Mixed_()), 'non-empty-array'], | 
|  | 44 | +            'non-empty-array of single type' => [new NonEmptyArray(new String_()), 'non-empty-array<string>'], | 
|  | 45 | +            'non-empty-array of compound type' => | 
|  | 46 | +                [ | 
|  | 47 | +                    new NonEmptyArray( | 
|  | 48 | +                        new Compound([new Integer(), new String_()]), | 
|  | 49 | +                        new String_() | 
|  | 50 | +                    ), | 
|  | 51 | +                    'non-empty-array<string,int|string>', | 
|  | 52 | +                ], | 
|  | 53 | +        ]; | 
|  | 54 | +    } | 
|  | 55 | +} | 
0 commit comments