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_content\Functional; use Dru..

Decoded Output download

<?php

declare(strict_types=1);

namespace Drupal\Testslock_content\Functional;

use Drupallock_content\Entity\BlockContent;
use Drupal\Testslock\Traits\BlockCreationTrait;
use Drupal\Tests\BrowserTestBase;

/**
 * Tests unpublishing of block_content entities.
 *
 * @group block_content
 */
class UnpublishedBlockTest extends BrowserTestBase {

  use BlockCreationTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['block_content'];

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

  /**
   * Tests unpublishing of block_content entities.
   */
  public function testViewShowsCorrectStates(): void {
    $block_content = BlockContent::create([
      'info' => 'Test block',
      'type' => 'basic',
    ]);
    $block_content->save();

    $block = $this->placeBlock('block_content:' . $block_content->uuid());

    $this->drupalGet('<front>');
    $page = $this->getSession()->getPage();
    $this->assertTrue($page->has('css', '#block-' . $block->id()));

    $block_content->setUnpublished();
    $block_content->save();

    $this->drupalGet('<front>');
    $page = $this->getSession()->getPage();
    $this->assertFalse($page->has('css', '#block-' . $block->id()));
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Drupal\Tests\block_content\Functional;

use Drupal\block_content\Entity\BlockContent;
use Drupal\Tests\block\Traits\BlockCreationTrait;
use Drupal\Tests\BrowserTestBase;

/**
 * Tests unpublishing of block_content entities.
 *
 * @group block_content
 */
class UnpublishedBlockTest extends BrowserTestBase {

  use BlockCreationTrait;

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['block_content'];

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

  /**
   * Tests unpublishing of block_content entities.
   */
  public function testViewShowsCorrectStates(): void {
    $block_content = BlockContent::create([
      'info' => 'Test block',
      'type' => 'basic',
    ]);
    $block_content->save();

    $block = $this->placeBlock('block_content:' . $block_content->uuid());

    $this->drupalGet('<front>');
    $page = $this->getSession()->getPage();
    $this->assertTrue($page->has('css', '#block-' . $block->id()));

    $block_content->setUnpublished();
    $block_content->save();

    $this->drupalGet('<front>');
    $page = $this->getSession()->getPage();
    $this->assertFalse($page->has('css', '#block-' . $block->id()));
  }

}

Function Calls

None

Variables

None

Stats

MD5 dae9a0dc52859afa5f6cdf1a17f4880f
Eval Count 0
Decode Time 88 ms