public function ModifiedFilesTest::testModifiedFiles in Automatic Updates 8
Tests modified files service.
File
- tests/
src/ Kernel/ ReadinessChecker/ ModifiedFilesTest.php, line 28
Class
- ModifiedFilesTest
- Tests of automatic updates.
Namespace
Drupal\Tests\automatic_updates\Kernel\ReadinessCheckerCode
public function testModifiedFiles() {
/** @var \Prophecy\Prophecy\ObjectProphecy|\Drupal\automatic_updates\Services\ModifiedFilesInterface $service */
$service = $this
->prophesize(ModifiedFilesInterface::class);
$service
->getModifiedFiles(Argument::type('array'))
->willReturn(new \ArrayIterator());
$modules = $this->container
->get('extension.list.module');
$profiles = $this->container
->get('extension.list.profile');
$themes = $this->container
->get('extension.list.theme');
// No modified code.
$modified_files = new ModifiedFiles($service
->reveal(), $modules, $profiles, $themes);
$messages = $modified_files
->run();
$this
->assertEmpty($messages);
// Hash doesn't match i.e. modified code.
$service
->getModifiedFiles(Argument::type('array'))
->willReturn(new \ArrayIterator([
'core/LICENSE.txt',
]));
$messages = $modified_files
->run();
$this
->assertCount(1, $messages);
}