You are here

public function ContentReportCase::testContentDuplicateTitlesWarn in Site Audit 8.2

Warn if nodes with duplicate titles present.

File

tests/contentReportTest.php, line 170
Contains /site_audit/tests/ContentReportCase.

Class

ContentReportCase
Class ContentReportCase.

Namespace

Unish

Code

public function testContentDuplicateTitlesWarn() {
  $this
    ->drush('pm-enable', array(
    'node',
  ), $this->options);
  $eval1 = <<<EOT
\$nodeStore = \\Drupal::entityManager()->getStorage('node');
\$node = \$nodeStore->create(array(
  'nid' => NULL,
  'type' => 'node',
  'title' => 'Site Audit',
  'uid' => 1,
  'revision' => 0,
  'status' => TRUE,
  'promote' => 0,
  'created' => 1,
  'langcode' => 'und',
));
\$node->save();
EOT;
  $eval1 .= <<<EOT
\$nodeStore = \\Drupal::entityManager()->getStorage('node');
\$node = \$nodeStore->create(array(
  'nid' => NULL,
  'type' => 'node',
  'title' => 'Site Audit',
  'uid' => 1,
  'revision' => 0,
  'status' => TRUE,
  'promote' => 0,
  'created' => 1,
  'langcode' => 'und',
));
\$node->save();
EOT;
  $this
    ->drush('php-eval', array(
    $eval1,
  ), $this->options);
  $this
    ->drush('audit-content', array(), $this->options + array(
    'detail' => NULL,
    'json' => NULL,
  ));
  $output = json_decode($this
    ->getOutput());
  $this
    ->assertEquals(\SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN, $output->checks->SiteAuditCheckContentDuplicateTitles->score);
}