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 Livewire\Drawer; use Livewire\Component; use Livewire\Exceptions\RootTag..
Decoded Output download
<?php
namespace Livewire\Drawer;
use Livewire\Component;
use Livewire\Exceptions\RootTagMissingFromViewException;
use Livewire\Livewire;
class UnitTest extends \Tests\TestCase
{
public function test_root_element_has_id_and_component_data()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertTrue(
str($component->html())->containsAll([$component->id(), 'foo'])
);
}
public function test_root_element_exists()
{
$this->expectException(RootTagMissingFromViewException::class);
Livewire::test(ComponentRootExists::class);
}
public function test_component_data_stored_in_html_is_escaped()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertStringContainsString(
<<<EOT
{"string":"foo","array":[["foo"],{"s":"arr"}],"object":[{"foo":"bar"},{"s":"arr"}],"number":1,"quote":"\"","singleQuote":"'"}
EOT
,
$component->html()
);
}
public function test_if_element_is_a_comment_it_is_skipped_and_id_and_data_inserted_on_next_elemenet()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertStringContainsString(
<<<EOT
<!-- Test comment <div>Commented out code</div> -->
<span wire:snapshot
EOT
,
$component->html()
);
}
public function test_if_element_is_a_comment_and_contains_html_it_is_skipped_and_id_and_data_inserted_on_next_elemenet()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertStringContainsString(
<<<EOT
<!-- Test comment <div>Commented out code</div> -->
<span wire:snapshot
EOT
,
$component->html()
);
}
public function test_on_subsequent_renders_root_element_has_id_but_not_component_id()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$component->call('$refresh');
$this->assertStringContainsString($component->id(), $component->html());
$this->assertStringNotContainsString('foo', $component->html());
}
}
class ComponentRootHasIdAndDataStub extends Component
{
public $string = 'foo';
public $array = ['foo'];
public $object = ['foo' => 'bar'];
public $number = 1;
public $quote = '"';
public $singleQuote = "'";
public function render()
{
return app('view')->make('show-name', ['name' => str()->random(5)]);
}
}
class ComponentRootExists extends Component
{
public function render()
{
return 'This all you got?!';
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Livewire\Drawer;
use Livewire\Component;
use Livewire\Exceptions\RootTagMissingFromViewException;
use Livewire\Livewire;
class UnitTest extends \Tests\TestCase
{
public function test_root_element_has_id_and_component_data()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertTrue(
str($component->html())->containsAll([$component->id(), 'foo'])
);
}
public function test_root_element_exists()
{
$this->expectException(RootTagMissingFromViewException::class);
Livewire::test(ComponentRootExists::class);
}
public function test_component_data_stored_in_html_is_escaped()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertStringContainsString(
<<<EOT
{"string":"foo","array":[["foo"],{"s":"arr"}],"object":[{"foo":"bar"},{"s":"arr"}],"number":1,"quote":"\"","singleQuote":"'"}
EOT
,
$component->html()
);
}
public function test_if_element_is_a_comment_it_is_skipped_and_id_and_data_inserted_on_next_elemenet()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertStringContainsString(
<<<EOT
<!-- Test comment <div>Commented out code</div> -->
<span wire:snapshot
EOT
,
$component->html()
);
}
public function test_if_element_is_a_comment_and_contains_html_it_is_skipped_and_id_and_data_inserted_on_next_elemenet()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$this->assertStringContainsString(
<<<EOT
<!-- Test comment <div>Commented out code</div> -->
<span wire:snapshot
EOT
,
$component->html()
);
}
public function test_on_subsequent_renders_root_element_has_id_but_not_component_id()
{
$component = Livewire::test(ComponentRootHasIdAndDataStub::class);
$component->call('$refresh');
$this->assertStringContainsString($component->id(), $component->html());
$this->assertStringNotContainsString('foo', $component->html());
}
}
class ComponentRootHasIdAndDataStub extends Component
{
public $string = 'foo';
public $array = ['foo'];
public $object = ['foo' => 'bar'];
public $number = 1;
public $quote = '"';
public $singleQuote = "'";
public function render()
{
return app('view')->make('show-name', ['name' => str()->random(5)]);
}
}
class ComponentRootExists extends Component
{
public function render()
{
return 'This all you got?!';
}
}
Function Calls
None |
Stats
MD5 | 76f9b55e25ff0366cf580f8c1eecf913 |
Eval Count | 0 |
Decode Time | 81 ms |