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 phpDocumentor\Reflection\DocBlock\Tags; use Mockery as m; use phpDocumen..
Decoded Output download
<?php
namespace phpDocumentor\Reflection\DocBlock\Tags; use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; class UsesTest extends TestCase { public function tearDown() : void { m::close(); } public function testIfCorrectTagNameIsReturned() : void { $fixture = new Uses(new Fqsen("\DateTime"), new Description("Description")); $this->assertSame("uses", $fixture->getName()); } public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Uses(new Fqsen("\DateTime"), new Description("Description")); $this->assertSame("@uses \DateTime Description", $fixture->render()); } public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Uses(new Fqsen("\DateTime"), new Description("Description")); $formatter = m::mock(Formatter::class); $formatter->shouldReceive("format")->with($fixture)->andReturn("Rendered output"); $this->assertSame("Rendered output", $fixture->render($formatter)); } public function testHasReferenceToFqsen() : void { $expected = new Fqsen("\DateTime"); $fixture = new Uses($expected); $this->assertSame($expected, $fixture->getReference()); } public function testHasDescription() : void { $expected = new Description("Description"); $fixture = new Uses(new Fqsen("\DateTime"), $expected); $this->assertSame($expected, $fixture->getDescription()); } public function testStringRepresentationIsReturned() : void { $fixture = new Uses(new Fqsen("\DateTime"), new Description("Description")); $this->assertSame("\DateTime Description", (string) $fixture); } public function testStringRepresentationIsReturnedWithoutDescription() : void { $fixture = new Uses(new Fqsen("\")); $this->assertSame("\", (string) $fixture); $fixture = new Uses(new Fqsen("\DateTime")); $this->assertSame("\DateTime", (string) $fixture); $fixture = new Uses(new Fqsen("\DateTime"), new Description('')); $this->assertSame("\DateTime", (string) $fixture); } public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); $context = new Context(''); $fqsen = new Fqsen("\DateTime"); $description = new Description("My Description"); $descriptionFactory->shouldReceive("create")->with("My Description", $context)->andReturn($description); $resolver->shouldReceive("resolve")->with("DateTime", $context)->andReturn($fqsen); $fixture = Uses::create("DateTime My Description", $resolver, $descriptionFactory, $context); $this->assertSame("\DateTime My Description", (string) $fixture); $this->assertSame($fqsen, $fixture->getReference()); $this->assertSame($description, $fixture->getDescription()); } public function testFactoryMethodWithoutSpaceBeforeClass() : void { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); $descriptionFactory = new DescriptionFactory($tagFactory); $context = new Context(''); $fixture = Uses::create("Foo My Description ", $fqsenResolver, $descriptionFactory, $context); $this->assertSame("\Foo My Description ", (string) $fixture); $this->assertInstanceOf(Fqsen::class, $fixture->getReference()); $this->assertSame("\Foo", (string) $fixture->getReference()); $this->assertSame("My Description ", $fixture->getDescription() . ''); } public function testFactoryMethodWithSpaceBeforeClass() : void { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); $descriptionFactory = new DescriptionFactory($tagFactory); $context = new Context(''); $fixture = Uses::create(" Foo My Description ", $fqsenResolver, $descriptionFactory, $context); $this->assertSame("\ Foo My Description ", (string) $fixture); $this->assertInstanceOf(Fqsen::class, $fixture->getReference()); $this->assertSame("\", (string) $fixture->getReference()); $this->assertSame("Foo My Description ", $fixture->getDescription() . ''); } public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { $this->expectException("InvalidArgumentException"); $this->assertNull(Uses::create('')); } public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException("InvalidArgumentException"); Uses::create("body"); } public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException("InvalidArgumentException"); Uses::create("body", new FqsenResolver()); } } ?>
Did this file decode correctly?
Original Code
<?php
namespace phpDocumentor\Reflection\DocBlock\Tags; use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; class UsesTest extends TestCase { public function tearDown() : void { m::close(); } public function testIfCorrectTagNameIsReturned() : void { $fixture = new Uses(new Fqsen("\x5c\x44\141\164\145\x54\x69\x6d\x65"), new Description("\104\x65\x73\143\x72\151\160\x74\151\157\156")); $this->assertSame("\x75\163\x65\163", $fixture->getName()); } public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Uses(new Fqsen("\134\x44\141\164\x65\x54\x69\x6d\145"), new Description("\104\x65\163\x63\x72\x69\160\164\151\157\x6e")); $this->assertSame("\x40\165\163\x65\x73\40\x5c\x44\141\x74\x65\124\x69\x6d\145\x20\x44\145\163\143\x72\151\160\x74\151\157\x6e", $fixture->render()); } public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Uses(new Fqsen("\134\x44\141\x74\145\124\x69\155\145"), new Description("\104\x65\163\143\162\x69\160\164\x69\x6f\x6e")); $formatter = m::mock(Formatter::class); $formatter->shouldReceive("\x66\157\x72\x6d\x61\x74")->with($fixture)->andReturn("\122\145\x6e\x64\145\162\145\x64\x20\157\x75\164\160\165\164"); $this->assertSame("\x52\145\156\144\x65\162\145\x64\x20\x6f\x75\164\160\165\164", $fixture->render($formatter)); } public function testHasReferenceToFqsen() : void { $expected = new Fqsen("\x5c\104\141\164\145\x54\151\155\145"); $fixture = new Uses($expected); $this->assertSame($expected, $fixture->getReference()); } public function testHasDescription() : void { $expected = new Description("\x44\145\x73\x63\162\x69\x70\x74\151\157\156"); $fixture = new Uses(new Fqsen("\x5c\104\141\164\x65\124\x69\x6d\x65"), $expected); $this->assertSame($expected, $fixture->getDescription()); } public function testStringRepresentationIsReturned() : void { $fixture = new Uses(new Fqsen("\134\104\141\x74\145\124\x69\155\145"), new Description("\104\x65\163\x63\x72\x69\160\164\x69\157\x6e")); $this->assertSame("\x5c\104\x61\x74\145\x54\151\155\x65\40\104\145\x73\143\162\151\160\164\151\157\156", (string) $fixture); } public function testStringRepresentationIsReturnedWithoutDescription() : void { $fixture = new Uses(new Fqsen("\134")); $this->assertSame("\x5c", (string) $fixture); $fixture = new Uses(new Fqsen("\134\x44\x61\164\x65\124\x69\x6d\145")); $this->assertSame("\134\104\x61\164\145\124\x69\x6d\145", (string) $fixture); $fixture = new Uses(new Fqsen("\x5c\104\141\x74\x65\x54\x69\x6d\145"), new Description('')); $this->assertSame("\134\104\141\164\145\124\x69\155\x65", (string) $fixture); } public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); $context = new Context(''); $fqsen = new Fqsen("\x5c\104\x61\164\145\124\x69\155\145"); $description = new Description("\x4d\x79\x20\104\x65\x73\x63\x72\x69\x70\164\151\x6f\x6e"); $descriptionFactory->shouldReceive("\x63\x72\145\141\164\145")->with("\115\171\x20\104\145\163\x63\x72\151\160\164\151\x6f\x6e", $context)->andReturn($description); $resolver->shouldReceive("\162\x65\x73\x6f\154\x76\145")->with("\x44\141\x74\145\x54\151\x6d\145", $context)->andReturn($fqsen); $fixture = Uses::create("\x44\141\x74\145\x54\x69\155\145\40\x4d\171\40\x44\x65\163\143\162\151\x70\164\x69\x6f\156", $resolver, $descriptionFactory, $context); $this->assertSame("\x5c\x44\x61\x74\x65\x54\x69\155\145\x20\x4d\171\40\104\145\x73\x63\162\x69\160\164\151\157\156", (string) $fixture); $this->assertSame($fqsen, $fixture->getReference()); $this->assertSame($description, $fixture->getDescription()); } public function testFactoryMethodWithoutSpaceBeforeClass() : void { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); $descriptionFactory = new DescriptionFactory($tagFactory); $context = new Context(''); $fixture = Uses::create("\x46\157\157\x20\115\171\x20\x44\145\163\x63\x72\151\x70\164\151\157\156\x20", $fqsenResolver, $descriptionFactory, $context); $this->assertSame("\134\106\157\x6f\x20\x4d\171\x20\104\145\163\143\162\151\160\x74\x69\x6f\x6e\40", (string) $fixture); $this->assertInstanceOf(Fqsen::class, $fixture->getReference()); $this->assertSame("\x5c\106\157\157", (string) $fixture->getReference()); $this->assertSame("\115\171\x20\104\145\x73\143\x72\151\160\x74\x69\x6f\156\40", $fixture->getDescription() . ''); } public function testFactoryMethodWithSpaceBeforeClass() : void { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); $descriptionFactory = new DescriptionFactory($tagFactory); $context = new Context(''); $fixture = Uses::create("\x20\106\157\157\x20\115\171\40\104\x65\163\x63\x72\151\x70\164\x69\157\x6e\40", $fqsenResolver, $descriptionFactory, $context); $this->assertSame("\134\40\x46\157\x6f\40\x4d\x79\x20\104\x65\163\143\162\x69\x70\x74\151\x6f\x6e\x20", (string) $fixture); $this->assertInstanceOf(Fqsen::class, $fixture->getReference()); $this->assertSame("\x5c", (string) $fixture->getReference()); $this->assertSame("\106\157\157\40\115\x79\40\x44\145\163\x63\162\151\160\x74\x69\157\156\x20", $fixture->getDescription() . ''); } public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { $this->expectException("\111\x6e\166\141\154\x69\144\x41\162\x67\165\155\x65\x6e\164\x45\170\x63\x65\x70\x74\x69\x6f\156"); $this->assertNull(Uses::create('')); } public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException("\111\156\166\x61\154\151\x64\x41\162\147\x75\155\145\156\x74\x45\x78\143\145\160\164\151\x6f\x6e"); Uses::create("\x62\157\x64\171"); } public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException("\x49\x6e\x76\141\x6c\x69\144\x41\162\147\x75\x6d\145\156\x74\x45\170\143\145\x70\x74\x69\157\x6e"); Uses::create("\x62\x6f\144\x79", new FqsenResolver()); } }
Function Calls
None |
Stats
MD5 | 55a3031951f276b8d73ba207019afcb7 |
Eval Count | 0 |
Decode Time | 110 ms |