DoubleSlashTest.php in Drupal 10
File
core/modules/migrate_drupal_ui/tests/src/Functional/d7/DoubleSlashTest.php
View source
<?php
namespace Drupal\Tests\migrate_drupal_ui\Functional\d7;
use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
use Drupal\migrate\Plugin\MigrationInterface;
class DoubleSlashTest extends MigrateUpgradeExecuteTestBase {
protected $profile = 'testing';
protected $defaultTheme = 'stark';
protected static $modules = [
'file',
'migrate_drupal_ui',
];
protected function setUp() : void {
parent::setUp();
$this
->loadFixture(\Drupal::service('extension.list.module')
->getPath('migrate_drupal') . '/tests/fixtures/drupal7.php');
}
public function testMigrateUpgradeExecute() {
$this->sourceDatabase
->update('file_managed')
->condition('fid', 1)
->fields([
'filename' => 'foo.txt',
'uri' => 'public://foo.txt',
])
->execute();
$edits = $this
->translatePostValues($this
->getCredentials());
$this
->drupalGet('/upgrade');
$this
->submitForm([], 'Continue');
$this
->submitForm($edits, 'Review upgrade');
$this
->submitForm([], 'I acknowledge I may lose data. Continue anyway.');
$this
->useTestMailCollector();
$this
->submitForm([], 'Perform upgrade');
$migration = $this
->getMigrationPluginManager()
->createInstance('d7_file');
$messages = $migration
->getIdMap()
->getMessages();
$count = 0;
foreach ($messages as $message) {
$count++;
$this
->assertStringContainsString('/migrate_drupal_ui/tests/src/Functional/d7/files/sites/default/files/foo.txt', $message->message);
$this
->assertSame(MigrationInterface::MESSAGE_ERROR, (int) $message->level);
}
$this
->assertSame(1, $count);
}
protected function getSourceBasePath() {
return __DIR__ . '/files';
}
protected function getEntityCounts() {
return [];
}
protected function getEntityCountsIncremental() {
return [];
}
protected function getAvailablePaths() {
return [];
}
protected function getMissingPaths() {
return [];
}
}
Classes
Name |
Description |
DoubleSlashTest |
Tests that a double slash is not in d7_file file not found migrate messages. |