<?php

/*
 * This file is part of Psy Shell.
 *
 * (c) 2012-2018 Justin Hileman
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Psy\Test\Reflection;

use Psy\Reflection\ReflectionLanguageConstruct;
use Psy\Reflection\ReflectionLanguageConstructParameter;

class ReflectionLanguageConstructParameterTest extends \PHPUnit\Framework\TestCase
{
    public function testOptions()
    {
        $keyword = new ReflectionLanguageConstruct('die');

        $refl = new ReflectionLanguageConstructParameter($keyword, 'one', [
            'isArray' => false,
            'defaultValue' => null,
            'isOptional' => false,
            'isPassedByReference' => false,
        ]);

        $this->assertEquals('one', $refl->getName());
        $this->assertFalse($refl->isArray());
        $this->assertTrue($refl->isDefaultValueAvailable());
        $this->assertNull($refl->getDefaultValue());
        $this->assertFalse($refl->isOptional());
        $this->assertFalse($refl->isPassedByReference());

        $reflTwo = new ReflectionLanguageConstructParameter($keyword, 'two', [
            'isArray' => true,
            'isOptional' => true,
            'isPassedByReference' => true,
        ]);

        $this->assertEquals('two', $reflTwo->getName());
        $this->assertTrue($reflTwo->isArray());
        $this->assertFalse($reflTwo->isDefaultValueAvailable());
        $this->assertNull($reflTwo->getDefaultValue());
        $this->assertTrue($reflTwo->isOptional());
        $this->assertTrue($reflTwo->isPassedByReference());

        $refl = new ReflectionLanguageConstructParameter($keyword, 'three', [
            'defaultValue' => 3,
        ]);

        $this->assertEquals('three', $refl->getName());
        $this->assertFalse($refl->isArray());
        $this->assertTrue($refl->isDefaultValueAvailable());
        $this->assertEquals(3, $refl->getDefaultValue());
        $this->assertFalse($refl->isOptional());
        $this->assertFalse($refl->isPassedByReference());
    }
}

Add coverage for reflection language construct parameters.
Add coverage for reflection language construct parameters.