You are here

protected function Fix404RedirectCronJobTest::assert404RowHelper in Redirect 8

Passes if the row with the given parameters is in the redirect_404 table.

Parameters

string $path: The path of the request.

string $langcode: (optional) The langcode of the request.

bool $not_exists: (optional) TRUE if this 404 row should not exist in the redirect_404 table, FALSE if it should. Defaults to TRUE.

2 calls to Fix404RedirectCronJobTest::assert404RowHelper()
Fix404RedirectCronJobTest::assert404Row in modules/redirect_404/tests/src/Kernel/Fix404RedirectCronJobTest.php
Passes if the row with the given parameters is in the redirect_404 table.
Fix404RedirectCronJobTest::assertNo404Row in modules/redirect_404/tests/src/Kernel/Fix404RedirectCronJobTest.php
Passes if the row with the given parameters is NOT in the redirect_404 table.

File

modules/redirect_404/tests/src/Kernel/Fix404RedirectCronJobTest.php, line 208

Class

Fix404RedirectCronJobTest
Tests the clean up cron job for redirect_404.

Namespace

Drupal\Tests\redirect_404\Kernel

Code

protected function assert404RowHelper($path, $langcode = 'en', $not_exists = TRUE) {
  $result = Database::getConnection()
    ->select('redirect_404', 'r404')
    ->fields('r404', [
    'path',
  ])
    ->condition('path', $path)
    ->condition('langcode', $langcode)
    ->condition('resolved', 0)
    ->execute()
    ->fetchField();
  if ($not_exists) {
    $this
      ->assertNotEquals($path, $result);
  }
  else {
    $this
      ->assertEquals($path, $result);
  }
}