setUp example

class UnpublishByKeywordActionTest extends KernelTestBase {

  /** * {@inheritdoc} */
  protected static $modules = ['action', 'node', 'system', 'user', 'field'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installEntitySchema('node');
    $this->installEntitySchema('user');
    $this->installSchema('node', ['node_access']);
    // Install system's configuration as default date formats are needed.     $this->installConfig(['system']);
    // Create a node type for testing.     $type = NodeType::create(['type' => 'page', 'name' => 'page', 'display_submitted' => FALSE]);
    $type->save();
  }

  /** * Tests creating an action using the node_unpublish_by_keyword_action plugin. */
/** * The entity field manager. * * @var \Drupal\Core\Entity\EntityFieldManagerInterface */
  protected $entityFieldManager;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->entityTypeInfo = $this->container->get('class_resolver')->getInstanceFromDefinition(EntityTypeInfo::class);
    $this->entityTypeManager = $this->container->get('entity_type.manager');
    $this->entityFieldManager = $this->container->get('entity_field.manager');

    $this->installConfig(['content_moderation']);
  }

  /** * @covers ::entityBaseFieldInfo */
  
/** * The tested translation manager. * * @var \Drupal\Core\StringTranslation\TranslationManager */
  protected $translationManager;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->translationManager = new TestTranslationManager();
  }

  /** * Provides some test data for formatPlural() * @return array */
  public function providerTestFormatPlural() {
    return [
      [1, 'Singular', '@count plural', [][], 'Singular'],
      [
/** * The database connection used. * * @var \Drupal\Core\Database\Connection */
  protected $database;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installSchema('user', ['users_data']);
    $this->installEntitySchema('entity_test_update');
    $this->moduleHandler = $this->container->get('module_handler');
    $this->database = $this->container->get('database');
  }

  /** * Tests making use of a custom bundle field. */
  public function testCustomBundleFieldUsage() {
    entity_test_create_bundle('custom', NULL, 'entity_test_update');

    

        }
        $this->assertTrue($found, "$hook() was called on expected argument");
      }
    }
  }

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->fieldStorages = [];
    $this->entities = [];
    $this->entitiesByBundles = [];

    // Create two bundles.     $this->bundles = ['bb_1' => 'bb_1', 'bb_2' => 'bb_2'];
    foreach ($this->bundles as $name => $desc) {
      entity_test_create_bundle($name$desc);
    }

    
/** * Views used by this test. * * @var array */
  public static $testViews = ['test_comment_schema'];

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = ['comment_test_views']): void {
    parent::setUp($import_test_views$modules);
  }

  /** * Tests that "approve comment" link exists and works as expected. */
  public function testCommentApproveLink() {
    $this->drupalLogin($this->drupalCreateUser(['administer comments']));
    // Set the comment status to unpublished.     $this->comment->setUnpublished();
    $this->comment->save();
    $this->drupalGet('/admin/moderate-comments');
    
'field',
    'filter',
    'text',
    'node',
    'book',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installSchema('book', ['book']);
    $this->installSchema('node', ['node_access']);
    $this->installConfig(['node', 'book', 'field']);
    // For uninstall to work.     $this->installSchema('user', ['users_data']);
  }

  /** * Tests the book_system_info_alter() method. */
/** * The help block instance. * * @var \Drupal\block\Entity\Block */
  protected $helpBlock;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->helpBlock = $this->placeBlock('help_block');
  }

  /** * Logs in users, tests help pages. */
  public function testHelp() {
    $this->drupalGet('help_page_test/has_help');
    $this->assertSession()->pageTextContains('I have help!');
    $this->assertSession()->pageTextContains($this->helpBlock->label());

    
use SchemaConfigListenerTestTrait;

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

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    // Install configuration provided by the module so that the order of the     // config keys is the same as     // \Drupal\FunctionalTests\Core\Config\SchemaConfigListenerTest.     $this->installConfig(['config_test']);
  }

}

class MigrateUserPictureFieldTest extends MigrateDrupal7TestBase {

  protected static $modules = ['image', 'file'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->executeMigration('user_picture_field');
  }

  /** * Tests the user picture field migration. */
  public function testUserPictureField() {
    /** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
    $field_storage = FieldStorageConfig::load('user.user_picture');
    $this->assertInstanceOf(FieldStorageConfigInterface::class$field_storage);
    $this->assertSame('user.user_picture', $field_storage->id());
    
/** * The node access control handler. * * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface */
  protected $accessHandler;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    // Create Basic page and Article node types.     if ($this->profile != 'standard') {
      $this->drupalCreateContentType([
        'type' => 'page',
        'name' => 'Basic page',
        'display_submitted' => FALSE,
      ]);
      $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
    }
    $this->accessHandler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
  }

class RendererBubblingTest extends RendererTestBase {

  /** * {@inheritdoc} */
  protected function setUp(): void {
    // Disable the required cache contexts, so that this test can test just the     // bubbling behavior.     $this->rendererConfig['required_cache_contexts'] = [];

    parent::setUp();
  }

  /** * Tests bubbling of assets when NOT using #pre_render callbacks. */
  public function testBubblingWithoutPreRender() {
    $this->setUpRequest();
    $this->setupMemoryCache();

    $this->cacheContextsManager->expects($this->any())
      ->method('convertTokensToKeys')
      

  protected $term2;

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE, $modules = []): void {
    // Important: taxonomy_test_views module must not be in the $modules to     // avoid an issue that particular view is already exists.     parent::setUp($import_test_views$modules);
    $this->mockStandardInstall();

    // This needs to be done again after ::mockStandardInstall() to make     // test vocabularies available.     // Explicitly add taxonomy_test_views to $modules now, so required views are     // being created.     $modules[] = 'taxonomy_test_views';
    if ($import_test_views) {
      ViewTestData::createTestViews(static::class$modules);
    }

    

  public static function setUpBeforeClass(): void {
    parent::setUpBeforeClass();
    VarDumper::setHandler(TestVarDumper::class D '::cliHandler');
  }

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    // Ensure that an instantiated container in the global state of \Drupal from     // a previous test does not leak into this test.     \Drupal::unsetContainer();

    // Ensure that the NullFileCache implementation is used for the FileCache as     // unit tests should not be relying on caches implicitly.     FileCacheFactory::setConfiguration([FileCacheFactory::DISABLE_CACHE => TRUE]);
    // Ensure that FileCacheFactory has a prefix.     FileCacheFactory::setPrefix('prefix');

    $this->root = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)), 2);
  }

class PhpStorageFactoryTest extends KernelTestBase {

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    // Empty the PHP storage settings, as KernelTestBase sets it by default.     $settings = Settings::getAll();
    unset($settings['php_storage']);
    new Settings($settings);
  }

  /** * Tests the get() method with no settings. */
  public function testGetNoSettings() {
    
Home | Imprint | This part of the site doesn't use cookies.