Unverified Commit 8ce8eb9b authored by larowlan's avatar larowlan
Browse files

Issue #3241130 by alexpott: Migrate units test trigger deprecations on PHP 8.1

parent ac01e625
...@@ -200,6 +200,9 @@ protected function runEnsureTablesTest($schema) { ...@@ -200,6 +200,9 @@ protected function runEnsureTablesTest($schema) {
$database->expects($this->any()) $database->expects($this->any())
->method('schema') ->method('schema')
->willReturn($schema); ->willReturn($schema);
$database->expects($this->any())
->method('tablePrefix')
->willReturn('');
$migration = $this->getMigration(); $migration = $this->getMigration();
$plugin = $this->createMock('Drupal\migrate\Plugin\MigrateSourceInterface'); $plugin = $this->createMock('Drupal\migrate\Plugin\MigrateSourceInterface');
$plugin->expects($this->any()) $plugin->expects($this->any())
......
...@@ -72,13 +72,13 @@ public function testMakeUniqueEntityField($count, $postfix = '', $start = NULL, ...@@ -72,13 +72,13 @@ public function testMakeUniqueEntityField($count, $postfix = '', $start = NULL,
if ($postfix) { if ($postfix) {
$configuration['postfix'] = $postfix; $configuration['postfix'] = $postfix;
} }
$configuration['start'] = isset($start) ? $start : NULL; $configuration['start'] = $start;
$configuration['length'] = isset($length) ? $length : NULL; $configuration['length'] = $length;
$plugin = new MakeUniqueEntityField($configuration, 'make_unique', [], $this->getMigration(), $this->entityTypeManager); $plugin = new MakeUniqueEntityField($configuration, 'make_unique', [], $this->getMigration(), $this->entityTypeManager);
$this->entityQueryExpects($count); $this->entityQueryExpects($count);
$value = $this->randomMachineName(32); $value = $this->randomMachineName(32);
$actual = $plugin->transform($value, $this->migrateExecutable, $this->row, 'testproperty'); $actual = $plugin->transform($value, $this->migrateExecutable, $this->row, 'testproperty');
$expected = mb_substr($value, $start, $length); $expected = mb_substr($value, $start ?? 0, $length);
$expected .= $count ? $postfix . $count : ''; $expected .= $count ? $postfix . $count : '';
$this->assertSame($expected, $actual); $this->assertSame($expected, $actual);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment