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 Drupal\Tests\color\Functional; use Drupal\Core\Url; use Drupal\Tests\Bro..
Decoded Output download
<?php
namespace Drupal\Tests\color\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
/**
* Tests sanitizing color preview loaded from theme.
*
* @group color
*/
class ColorSafePreviewTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var string[]
*/
public static $modules = ['color', 'color_test'];
/**
* A user with administrative permissions.
*
* @var \Drupal\user\UserInterface
*/
protected $bigUser;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Create user.
$this->bigUser = $this->drupalCreateUser(['administer themes']);
}
/**
* Ensures color preview.html is sanitized.
*/
public function testColorPreview() {
// Install the color test theme.
\Drupal::service('theme_handler')->install(['color_test_theme']);
$this->drupalLogin($this->bigUser);
// Markup is being printed from a HTML file located in:
// core/modules/color/tests/modules/color_test/themes/color_test_theme/color/preview.html
$url = Url::fromRoute('system.theme_settings_theme', ['theme' => 'color_test_theme']);
$this->drupalGet($url);
$this->assertText('TEST COLOR PREVIEW');
$this->assertNoRaw('<script>alert("security filter test");</script>');
$this->assertRaw('<h2>TEST COLOR PREVIEW</h2>');
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\Tests\color\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
/**
* Tests sanitizing color preview loaded from theme.
*
* @group color
*/
class ColorSafePreviewTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var string[]
*/
public static $modules = ['color', 'color_test'];
/**
* A user with administrative permissions.
*
* @var \Drupal\user\UserInterface
*/
protected $bigUser;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Create user.
$this->bigUser = $this->drupalCreateUser(['administer themes']);
}
/**
* Ensures color preview.html is sanitized.
*/
public function testColorPreview() {
// Install the color test theme.
\Drupal::service('theme_handler')->install(['color_test_theme']);
$this->drupalLogin($this->bigUser);
// Markup is being printed from a HTML file located in:
// core/modules/color/tests/modules/color_test/themes/color_test_theme/color/preview.html
$url = Url::fromRoute('system.theme_settings_theme', ['theme' => 'color_test_theme']);
$this->drupalGet($url);
$this->assertText('TEST COLOR PREVIEW');
$this->assertNoRaw('<script>alert("security filter test");</script>');
$this->assertRaw('<h2>TEST COLOR PREVIEW</h2>');
}
}
Function Calls
None |
Stats
MD5 | 4f6c476fe6ab876982a975619a14414c |
Eval Count | 0 |
Decode Time | 88 ms |