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\block\Functional; use Drupal\Component\Utility\Unicode; use..

Decoded Output download

<?php

namespace Drupal\Tests\block\Functional;

use Drupal\Component\Utility\Unicode;
use Drupal\Tests\BrowserTestBase;

/**
 * Tests for Block module regarding hook_entity_operations_alter().
 *
 * @group block
 */
class BlockHookOperationTest extends BrowserTestBase {

  /**
   * Modules to install.
   *
   * @var array
   */
  public static $modules = ['block', 'entity_test'];

  protected function setUp() {
    parent::setUp();

    $permissions = [
      'administer blocks',
    ];

    // Create and log in user.
    $admin_user = $this->drupalCreateUser($permissions);
    $this->drupalLogin($admin_user);
  }

  /**
   * Tests the block list to see if the test_operation link is added.
   */
  public function testBlockOperationAlter() {
    // Add a test block, any block will do.
    // Set the machine name so the test_operation link can be built later.
    $block_id = Unicode::strtolower($this->randomMachineName(16));
    $this->drupalPlaceBlock('system_powered_by_block', ['id' => $block_id]);

    // Get the Block listing.
    $this->drupalGet('admin/structure/block');

    $test_operation_link = 'admin/structure/block/manage/' . $block_id . '/test_operation';
    // Test if the test_operation link is on the page.
    $this->assertLinkByHref($test_operation_link);
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\Tests\block\Functional;

use Drupal\Component\Utility\Unicode;
use Drupal\Tests\BrowserTestBase;

/**
 * Tests for Block module regarding hook_entity_operations_alter().
 *
 * @group block
 */
class BlockHookOperationTest extends BrowserTestBase {

  /**
   * Modules to install.
   *
   * @var array
   */
  public static $modules = ['block', 'entity_test'];

  protected function setUp() {
    parent::setUp();

    $permissions = [
      'administer blocks',
    ];

    // Create and log in user.
    $admin_user = $this->drupalCreateUser($permissions);
    $this->drupalLogin($admin_user);
  }

  /**
   * Tests the block list to see if the test_operation link is added.
   */
  public function testBlockOperationAlter() {
    // Add a test block, any block will do.
    // Set the machine name so the test_operation link can be built later.
    $block_id = Unicode::strtolower($this->randomMachineName(16));
    $this->drupalPlaceBlock('system_powered_by_block', ['id' => $block_id]);

    // Get the Block listing.
    $this->drupalGet('admin/structure/block');

    $test_operation_link = 'admin/structure/block/manage/' . $block_id . '/test_operation';
    // Test if the test_operation link is on the page.
    $this->assertLinkByHref($test_operation_link);
  }

}

Function Calls

None

Variables

None

Stats

MD5 573cb440f1ad6cf8d06c6f05a2452348
Eval Count 0
Decode Time 91 ms