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\contact\Tests\Views; use Drupal\field\Entity\FieldConfig; use Dru..
Decoded Output download
<?php
namespace Drupal\contact\Tests\Views;
use Drupalield\Entity\FieldConfig;
use Drupaliews\Tests\ViewTestBase;
use Drupalield\Entity\FieldStorageConfig;
use Drupal\contact\Entity\ContactForm;
/**
* Tests which checks that no fieldapi fields are added on contact.
*
* @group contact
*/
class ContactFieldsTest extends ViewTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['field', 'text', 'contact'];
/**
* Contains the field storage definition for contact used for this test.
*
* @var \Drupalield\Entity\FieldStorageConfig
*/
protected $fieldStorage;
protected function setUp() {
parent::setUp();
$this->fieldStorage = FieldStorageConfig::create([
'field_name' => strtolower($this->randomMachineName()),
'entity_type' => 'contact_message',
'type' => 'text'
]);
$this->fieldStorage->save();
ContactForm::create([
'id' => 'contact_message',
'label' => 'Test contact form',
])->save();
FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => 'contact_message',
])->save();
$this->container->get('views.views_data')->clear();
}
/**
* Tests the views data generation.
*/
public function testViewsData() {
// Test that the field is not exposed to views, since contact_message
// entities have no storage.
$table_name = 'contact_message__' . $this->fieldStorage->getName();
$data = $this->container->get('views.views_data')->get($table_name);
$this->assertFalse($data, 'The field is not exposed to Views.');
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\contact\Tests\Views;
use Drupal\field\Entity\FieldConfig;
use Drupal\views\Tests\ViewTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\contact\Entity\ContactForm;
/**
* Tests which checks that no fieldapi fields are added on contact.
*
* @group contact
*/
class ContactFieldsTest extends ViewTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['field', 'text', 'contact'];
/**
* Contains the field storage definition for contact used for this test.
*
* @var \Drupal\field\Entity\FieldStorageConfig
*/
protected $fieldStorage;
protected function setUp() {
parent::setUp();
$this->fieldStorage = FieldStorageConfig::create([
'field_name' => strtolower($this->randomMachineName()),
'entity_type' => 'contact_message',
'type' => 'text'
]);
$this->fieldStorage->save();
ContactForm::create([
'id' => 'contact_message',
'label' => 'Test contact form',
])->save();
FieldConfig::create([
'field_storage' => $this->fieldStorage,
'bundle' => 'contact_message',
])->save();
$this->container->get('views.views_data')->clear();
}
/**
* Tests the views data generation.
*/
public function testViewsData() {
// Test that the field is not exposed to views, since contact_message
// entities have no storage.
$table_name = 'contact_message__' . $this->fieldStorage->getName();
$data = $this->container->get('views.views_data')->get($table_name);
$this->assertFalse($data, 'The field is not exposed to Views.');
}
}
Function Calls
None |
Stats
MD5 | 3fa77611ec88a8fc21c95b13661a2176 |
Eval Count | 0 |
Decode Time | 172 ms |