StatisticsAttachedTest.php in Zircon Profile 8
File
core/modules/statistics/src/Tests/StatisticsAttachedTest.php
View source
<?php
namespace Drupal\statistics\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\node\Entity\Node;
class StatisticsAttachedTest extends WebTestBase {
public static $modules = array(
'node',
'statistics',
);
protected function setUp() {
parent::setUp();
$this
->drupalCreateContentType([
'type' => 'page',
]);
$theme = 'statistics_test_attached';
\Drupal::service('theme_handler')
->install(array(
$theme,
));
$this
->config('system.theme')
->set('default', $theme)
->save();
\Drupal::service('router.builder')
->rebuildIfNeeded();
}
public function testAttached() {
$node = Node::create([
'type' => 'page',
'title' => 'Page node',
'body' => 'body text',
]);
$node
->save();
$this
->drupalGet('node/' . $node
->id());
$this
->assertRaw('core/modules/statistics/statistics.js', 'Statistics library is available');
}
}