<NME> LicenseTagTest.php
<BEF> <?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace ZendTest\Code\Generator\DocBlock\Tag;

use PHPUnit\Framework\TestCase;
use Zend\Code\Generator\DocBlock\Tag\LicenseTag;
use Zend\Code\Generator\DocBlock\TagManager;
use Zend\Code\Reflection\DocBlockReflection;

/**
 * @group Zend_Code_Generator
 * @group Zend_Code_Generator_Php
 */
class LicenseTagTest extends TestCase
{
    /**
     * @var LicenseTag
     */
    protected $tag;

    /**
     * @var TagManager
     */
    protected $tagmanager;

    protected function setUp() : void
    {
        $this->tag = new LicenseTag();
        $this->tagmanager = new TagManager();
        $this->tagmanager->initializeDefaultTags();
    }

    protected function tearDown() : void
    {
        $this->tag = null;
        $this->tagmanager = null;
    }

    public function testGetterAndSetterPersistValue()
    {
        $this->tag->setUrl('foo');
        $this->tag->setLicenseName('bar');

        self::assertEquals('foo', $this->tag->getUrl());
        $this->tag->setLicenseName('bar bar bar');
        $this->assertEquals('@license foo bar bar bar', $this->tag->generate());
    }
}
        $this->tag->setOptions([
            'url' => 'foo',
            'licenseName' => 'bar',
        ]);
        $tagWithOptionsFromConstructor = new LicenseTag('foo', 'bar');
        self::assertEquals($this->tag->generate(), $tagWithOptionsFromConstructor->generate());
    }

    public function testCreatingTagFromReflection()
    {
        $docreflection = new DocBlockReflection('/** @license http://zend.com License');
        $reflectionTag = $docreflection->getTag('license');

        /** @var LicenseTag $tag */
        $tag = $this->tagmanager->createTagFromReflection($reflectionTag);
        self::assertInstanceOf(LicenseTag::class, $tag);
        self::assertEquals('http://zend.com', $tag->getUrl());
        self::assertEquals('License', $tag->getLicenseName());
    }
}

<MSG> Test setting of options via constructor
<DFF> @@ -52,4 +52,17 @@ class LicenseTagTest extends \PHPUnit_Framework_TestCase
         $this->tag->setLicenseName('bar bar bar');
         $this->assertEquals('@license foo bar bar bar', $this->tag->generate());
     }
+
+    public function testConstructorWithOptions()
+    {
+        $this->tag->setOptions(array(
+            'url' => 'foo',
+            'licenseName' => 'bar',
+        ));
+        $tagWithOptionsFromConstructor = new LicenseTag(array(
+            'url' => 'foo',
+            'licenseName' => 'bar',
+        ));
+        $this->assertEquals($this->tag->generate(), $tagWithOptionsFromConstructor->generate());
+    }
 }

Test setting of options via constructor