You are here

public function FileOwnershipTest::testFileOwnership in Automatic Updates 8

Tests the functionality of modified code readiness checks.

File

tests/src/Kernel/ReadinessChecker/FileOwnershipTest.php, line 26

Class

FileOwnershipTest
Tests modified code readiness checking.

Namespace

Drupal\Tests\automatic_updates\Kernel\ReadinessChecker

Code

public function testFileOwnership() {

  // No ownership problems.
  $file_ownership = new FileOwnership($this->container
    ->get('app.root'));
  $messages = $file_ownership
    ->run();
  $this
    ->assertEmpty($messages);

  // Ownership problems.
  $file_ownership = new TestFileOwnership($this->container
    ->get('app.root'));
  $messages = $file_ownership
    ->run();
  $this
    ->assertCount(1, $messages);
  $this
    ->assertStringStartsWith('Files are owned by uid "23"', (string) $messages[0]);
  $this
    ->assertStringEndsWith('The file owner and PHP user should be the same during an update.', (string) $messages[0]);
}