getModulePath example

'language',
    'migrate_drupal_ui',
    'statistics',
    'telephone',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal7.php');
  }

  /** * {@inheritdoc} */
  protected function getSourceBasePath() {
    return __DIR__ . '/files';
  }

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

  /** * Tests the error handler. */
  public function testErrorHandler() {
    $config = $this->config('system.logging');
    $error_notice = [
      '%type' => 'Notice',
      '@message' => 'Object of class stdClass could not be converted to int',
      '%function' => 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()',
      '%file' => $this->getModulePath('error_test') . '/error_test.module',
    ];
    $error_warning = [
      '%type' => 'Warning',
      '@message' => 'var_export does not handle circular references',
      '%function' => 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()',
      '%file' => $this->getModulePath('error_test') . '/error_test.module',
    ];
    $error_user_notice = [
      '%type' => 'User warning',
      '@message' => 'Drupal & awesome',
      '%function' => 'Drupal\error_test\Controller\ErrorTestController->generateWarnings()',
      
'update',
    // Test migrations states.     'migrate_state_finished_test',
    'migrate_state_not_finished_test',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal7.php');
  }

  /** * {@inheritdoc} */
  protected function getSourceBasePath() {
    return __DIR__ . '/files';
  }

  /** * {@inheritdoc} */
'threshold' => [
        'requirements_warning' => 259200,
        'requirements_error' => 1209600,
      ],
      'logging' => 1,
    ];
    $expected_profile_data = ['_core' => ['default_config_hash' => Crypt::hashBase64(serialize($expected_profile_data))]] + $expected_profile_data;

    // Verify that the original data matches. We have to read the module config     // file directly, because the install profile default system.cron.yml     // configuration file was used to create the active configuration.     $config_dir = $this->getModulePath('system') . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
    $this->assertDirectoryExists($config_dir);
    $source_storage = new FileStorage($config_dir);
    $data = $source_storage->read($config_name);
    $this->assertSame($expected_original_data$data);

    // Verify that active configuration matches the expected data, which was     // created from the testing install profile's system.cron.yml file.     $config = $this->config($config_name);
    $this->assertSame($expected_profile_data$config->get());

    $config = $this->config('system.site');
    
'migrate',
    'migrate_drupal',
    'migrate_drupal_ui',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->fs = \Drupal::service('file_system');
    $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal7.php');
  }

  /** * Executes all steps of migrations upgrade. * * @param string $file_private_path * The source database file_private_path value. * @param string $file_public_path * The source database file_public_path value. * @param string $file_temporary_path * The source database file_temporary_path value. * @param string $private * The path to the source private files. * @param string $public * The path to the source public files. * @param string $temporary * The path to the source temporary files. * * @dataProvider providerTestFilePath */
// Clear the block cache to load the Statistics module's block definitions.     $this->container->get('plugin.manager.block')->clearCachedDefinitions();

    // Visit a node to have something show up in the block.     $node = $this->drupalCreateNode(['type' => 'page', 'uid' => $this->blockingUser->id()]);
    $this->drupalGet('node/' . $node->id());
    // Manually calling statistics.php, simulating ajax behavior.     $nid = $node->id();
    $post = http_build_query(['nid' => $nid]);
    $headers = ['Content-Type' => 'application/x-www-form-urlencoded'];
    global $base_url;
    $stats_path = $base_url . '/' . $this->getModulePath('statistics') . '/statistics.php';
    $client = \Drupal::httpClient();
    $client->post($stats_path['headers' => $headers, 'body' => $post]);

    // Configure and save the block.     $block = $this->drupalPlaceBlock('statistics_popular_block', [
      'label' => 'Popular content',
      'top_day_num' => 3,
      'top_all_num' => 3,
      'top_last_num' => 3,
    ]);

    
$output = \Drupal::token()->replace($input['node' => $node]['langcode' => $language_interface->getId()]);
      $this->assertEquals($expected$outputnew FormattableMarkup('Statistics token %token replaced.', ['%token' => $input]));
    }

    // Hit the node.     $this->drupalGet('node/' . $node->id());
    // Manually calling statistics.php, simulating ajax behavior.     $nid = $node->id();
    $post = http_build_query(['nid' => $nid]);
    $headers = ['Content-Type' => 'application/x-www-form-urlencoded'];
    global $base_url;
    $stats_path = $base_url . '/' . $this->getModulePath('statistics') . '/statistics.php';
    $client = \Drupal::httpClient();
    $client->post($stats_path['headers' => $headers, 'body' => $post]);
    /** @var \Drupal\statistics\StatisticsViewsResult $statistics */
    $statistics = \Drupal::service('statistics.storage.node')->fetchView($node->id());

    // Generate and test tokens.     $tests = [];
    $tests['[node:total-count]'] = 1;
    $tests['[node:day-count]'] = 1;
    $tests['[node:last-view]'] = $date_formatter->format($statistics->getTimestamp());
    $tests['[node:last-view:short]'] = $date_formatter->format($statistics->getTimestamp(), 'short');

    
/** * Tests the integration of the {node_counter} table in views. */
  public function testNodeCounterIntegration() {
    $this->drupalLogin($this->webUser);

    $this->drupalGet('node/' . $this->node->id());
    // Manually calling statistics.php, simulating ajax behavior.     // @see \Drupal\statistics\Tests\StatisticsLoggingTest::testLogging().     global $base_url;
    $stats_path = $base_url . '/' . $this->getModulePath('statistics') . '/statistics.php';
    $client = $this->getHttpClient();
    $client->post($stats_path['form_params' => ['nid' => $this->node->id()]]);
    $this->drupalGet('test_statistics_integration');

    /** @var \Drupal\statistics\StatisticsViewsResult $statistics */
    $statistics = \Drupal::service('statistics.storage.node')->fetchView($this->node->id());
    $this->assertSession()->pageTextContains('Total views: 1');
    $this->assertSession()->pageTextContains('Views today: 1');
    $this->assertSession()->pageTextContains('Most recent view: ' . date('Y', $statistics->getTimestamp()));

    $this->drupalLogout();
    
// @todo remove in https://www.drupal.org/project/drupal/issues/3267040     // Delete the existing content made to test the ID Conflict form. Migrations     // are to be done on a site without content. The test of the ID Conflict     // form is being moved to its own issue which will remove the deletion     // of the created nodes.     // See https://www.drupal.org/project/drupal/issues/3087061.     $this->nodeStorage = $this->container->get('entity_type.manager')
      ->getStorage('node');
    $this->nodeStorage->delete($this->nodeStorage->loadMultiple());

    $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal7.php');
  }

  /** * {@inheritdoc} */
  protected function getSourceBasePath() {
    return __DIR__ . '/files';
  }

  /** * {@inheritdoc} */
$this->drupalCreateContentType(['type' => 'page']);
    // Enable debug, rebuild the service container, and clear all caches.     $parameters = $this->container->getParameter('twig.config');
    $parameters['debug'] = TRUE;
    $this->setContainerParameter('twig.config', $parameters);
    $this->rebuildContainer();
    $this->resetAll();

    $cache = $this->container->get('theme.registry')->get();
    // Create array of Twig templates.     $templates = drupal_find_theme_templates($cache$extension$this->getThemePath('test_theme'));
    $templates += drupal_find_theme_templates($cache$extension$this->getModulePath('node'));

    // Create a node and test different features of the debug markup.     $node = $this->drupalCreateNode();
    $builder = \Drupal::entityTypeManager()->getViewBuilder('node');
    $build = $builder->view($node);
    $output = $renderer->renderRoot($build);
    $this->assertStringContainsString('<!-- THEME DEBUG -->', $output, 'Twig debug markup found in theme output when debug is enabled.');
    $this->assertStringContainsString("THEME HOOK: 'node'", $output, 'Theme call information found.');
    $this->assertStringContainsString('* node--1--full' . $extension . PHP_EOL . ' x node--1' . $extension . PHP_EOL . ' * node--page--full' . $extension . PHP_EOL . ' * node--page' . $extension . PHP_EOL . ' * node--full' . $extension . PHP_EOL . ' * node' . $extension$output, 'Suggested template files found in order and node ID specific template shown as current template.');
    $this->assertStringContainsString(Html::escape('node--<script type="text/javascript">alert(\'yo\');</script>')(string) $output);
    $this->assertStringContainsString('<!-- INVALID FILE NAME SUGGESTIONS:' . PHP_EOL . ' See https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/function/hook_theme_suggestions_alter' . PHP_EOL . ' invalid_theme_suggestions' . PHP_EOL . '-->', $output, 'Twig debug markup found invalid suggestions.');
    
'language',
    'migrate_drupal_ui',
    'statistics',
    'telephone',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal6.php');
  }

  /** * {@inheritdoc} */
  protected function getSourceBasePath() {
    return __DIR__ . '/files';
  }

  /** * {@inheritdoc} */
// @todo remove in https://www.drupal.org/project/drupal/issues/3267040     // Delete the existing content made to test the ID Conflict form. Migrations     // are to be done on a site without content. The test of the ID Conflict     // form is being moved to its own issue which will remove the deletion     // of the created nodes.     // See https://www.drupal.org/project/drupal/issues/3087061.     $this->nodeStorage = $this->container->get('entity_type.manager')
      ->getStorage('node');
    $this->nodeStorage->delete($this->nodeStorage->loadMultiple());

    $this->loadFixture($this->getModulePath('forum') . '/tests/fixtures/drupal7.php');
  }

  /** * {@inheritdoc} */
  protected function getSourceBasePath() {
    return __DIR__ . '/files';
  }

  /** * {@inheritdoc} */
    'migrate_state_finished_test',
    'migrate_state_not_finished_test',
    // Test missing migrate_drupal.yml.     'migrate_state_no_upgrade_path',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal6.php');
  }

  /** * {@inheritdoc} */
  protected function getSourceBasePath() {
    return __DIR__ . '/files';
  }

  /** * {@inheritdoc} */

  protected static $modules = [
    'forum',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->loadFixture($this->getModulePath('forum') . '/tests/fixtures/drupal6.php');
  }

  /** * {@inheritdoc} */
  protected function getSourceBasePath() {
    return __DIR__;
  }

  /** * Tests that Forum is displayed in the will be upgraded list. */

  protected function loadTestView($view_id) {
    // We just instantiate the test view from the raw configuration, as it may     // not be possible to save it, due to its faulty schema.     $config_dir = $this->getModulePath('views') . '/tests/fixtures/update';
    $file_storage = new FileStorage($config_dir);
    $values = $file_storage->read($view_id);
    /** @var \Drupal\views\ViewEntityInterface $test_view */
    $test_view = $this->container
      ->get('entity_type.manager')
      ->getStorage('view')
      ->create($values);
    return $test_view;
  }

}
Home | Imprint | This part of the site doesn't use cookies.