public function AuditFilesNotInDatabaseTest::testFileNotInDatabase in Audit Files 8.3
Same name and namespace in other branches
- 8.2 tests/src/Functional/AuditFilesNotInDatabaseTest.php \Drupal\Tests\auditfiles\Functional\AuditFilesNotInDatabaseTest::testFileNotInDatabase()
Tests that orphaned files display on the report.
An "orphan" file is one in the file system that has no corresponding record in the database.
File
- tests/
src/ Functional/ AuditFilesNotInDatabaseTest.php, line 95
Class
- AuditFilesNotInDatabaseTest
- Tests that the "Not in Database" report is reachable with no errors.
Namespace
Drupal\Tests\auditfiles\FunctionalCode
public function testFileNotInDatabase() {
// Form to test.
$path = Url::fromRoute('auditfiles.notindatabase');
// Establish session.
$session = $this
->assertSession();
// Log in as admin user.
$this
->drupalLogin($this->user);
// Load the report page.
$this
->drupalGet($path);
// Check for the report title.
$session
->pageTextContains("Not in database");
// Check that the report table is not empty.
$session
->elementNotContains('css', '#edit-files', 'No items found');
$session
->pageTextNotContains("Found no files on the server that are not in the database");
// Check that at least 36 files were found.
$session
->elementContains('xpath', '//*[@id="notindatabase"]/div[1]/em', "Found at least 36 files on the server that are not in the database");
}