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 declare(strict_types=1); namespace Drupal\Tests\block\FunctionalJavascript; use D..

Decoded Output download

<?php

declare(strict_types=1);

namespace Drupal\Testslock\FunctionalJavascript;

use Drupal\FunctionalJavascriptTests\WebDriverTestBase;

/**
 * Tests the contextual links added while rendering the block.
 *
 * @group block
 */
class BlockContextualLinksTest extends WebDriverTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['user', 'block', 'contextual'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Block id of the block.
   *
   * @var string
   */
  protected $blockId;

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();
    $this->drupalLogin($this->drupalCreateUser([
      'administer blocks',
      'access administration pages',
      'access contextual links',
    ]));
    $this->blockId = $this->defaultTheme . '_powered';
    $this->placeBlock('system_powered_by_block', [
      'id' => $this->blockId,
      'region' => 'content',
    ]);
  }

  /**
   * Test that remove/configure contextual links are present in the block.
   */
  public function testBlockContextualRemoveLinks(): void {
    $this->drupalGet('<front>');
    $contextual_id = "[data-contextual-id^='block:block=$this->blockId:langcode=en']";
    $this->assertSession()->waitForElement('css', "$contextual_id .contextual-links");

    $expected_configure_block_link = base_path() . 'admin/structure/block/manage/' . $this->blockId;
    $actual_configure_block_link = parse_url($this->getSession()->getPage()->findLink('Configure block')->getAttribute('href'));
    $this->assertEquals($expected_configure_block_link, $actual_configure_block_link['path']);

    $expected_remove_block_link = base_path() . 'admin/structure/block/manage/' . $this->blockId . '/delete';
    $actual_remove_block_link = parse_url($this->getSession()->getPage()->findLink('Remove block')->getAttribute('href'));
    $this->assertEquals($expected_remove_block_link, $actual_remove_block_link['path']);
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Drupal\Tests\block\FunctionalJavascript;

use Drupal\FunctionalJavascriptTests\WebDriverTestBase;

/**
 * Tests the contextual links added while rendering the block.
 *
 * @group block
 */
class BlockContextualLinksTest extends WebDriverTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['user', 'block', 'contextual'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Block id of the block.
   *
   * @var string
   */
  protected $blockId;

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();
    $this->drupalLogin($this->drupalCreateUser([
      'administer blocks',
      'access administration pages',
      'access contextual links',
    ]));
    $this->blockId = $this->defaultTheme . '_powered';
    $this->placeBlock('system_powered_by_block', [
      'id' => $this->blockId,
      'region' => 'content',
    ]);
  }

  /**
   * Test that remove/configure contextual links are present in the block.
   */
  public function testBlockContextualRemoveLinks(): void {
    $this->drupalGet('<front>');
    $contextual_id = "[data-contextual-id^='block:block=$this->blockId:langcode=en']";
    $this->assertSession()->waitForElement('css', "$contextual_id .contextual-links");

    $expected_configure_block_link = base_path() . 'admin/structure/block/manage/' . $this->blockId;
    $actual_configure_block_link = parse_url($this->getSession()->getPage()->findLink('Configure block')->getAttribute('href'));
    $this->assertEquals($expected_configure_block_link, $actual_configure_block_link['path']);

    $expected_remove_block_link = base_path() . 'admin/structure/block/manage/' . $this->blockId . '/delete';
    $actual_remove_block_link = parse_url($this->getSession()->getPage()->findLink('Remove block')->getAttribute('href'));
    $this->assertEquals($expected_remove_block_link, $actual_remove_block_link['path']);
  }

}

Function Calls

None

Variables

None

Stats

MD5 77d7ae48d7b5ae0dac338f993b847745
Eval Count 0
Decode Time 80 ms