Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace LaminasTest\Code\Generator\DocBlock\Tag; use Laminas\Code\Generator\DocB..
Decoded Output download
<?php
namespace LaminasTest\Code\Generator\DocBlock\Tag;
use Laminas\Code\Generator\DocBlock\Tag\LicenseTag;
use Laminas\Code\Generator\DocBlock\TagManager;
use Laminas\Code\Reflection\DocBlockReflection;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
#[Group('Laminas_Code_Generator')]
#[Group('Laminas_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::assertSame('foo', $this->tag->getUrl());
self::assertSame('bar', $this->tag->getLicenseName());
}
public function testNameIsCorrect()
{
self::assertSame('license', $this->tag->getName());
}
public function testLicenseProducesCorrectDocBlockLine()
{
$this->tag->setUrl('foo');
$this->tag->setLicenseName('bar bar bar');
self::assertSame('@license foo bar bar bar', $this->tag->generate());
}
public function testConstructorWithOptions()
{
$this->tag->setOptions([
'url' => 'foo',
'licenseName' => 'bar',
]);
$tagWithOptionsFromConstructor = new LicenseTag('foo', 'bar');
self::assertSame($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::assertSame('http://zend.com', $tag->getUrl());
self::assertSame('License', $tag->getLicenseName());
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace LaminasTest\Code\Generator\DocBlock\Tag;
use Laminas\Code\Generator\DocBlock\Tag\LicenseTag;
use Laminas\Code\Generator\DocBlock\TagManager;
use Laminas\Code\Reflection\DocBlockReflection;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
#[Group('Laminas_Code_Generator')]
#[Group('Laminas_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::assertSame('foo', $this->tag->getUrl());
self::assertSame('bar', $this->tag->getLicenseName());
}
public function testNameIsCorrect()
{
self::assertSame('license', $this->tag->getName());
}
public function testLicenseProducesCorrectDocBlockLine()
{
$this->tag->setUrl('foo');
$this->tag->setLicenseName('bar bar bar');
self::assertSame('@license foo bar bar bar', $this->tag->generate());
}
public function testConstructorWithOptions()
{
$this->tag->setOptions([
'url' => 'foo',
'licenseName' => 'bar',
]);
$tagWithOptionsFromConstructor = new LicenseTag('foo', 'bar');
self::assertSame($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::assertSame('http://zend.com', $tag->getUrl());
self::assertSame('License', $tag->getLicenseName());
}
}
Function Calls
| None |
Stats
| MD5 | db3376ef6a6b17ef1e4d41dd337ba395 |
| Eval Count | 0 |
| Decode Time | 88 ms |