Verified Commit f4e9c070 authored by Dave Long's avatar Dave Long
Browse files

Issue #3441718 by mondrake: Fix string array keys in data sets returned by...

Issue #3441718 by mondrake: Fix string array keys in data sets returned by data provider methods that do not match the parameter names in Unit tests
parent 9fdd5efd
Loading
Loading
Loading
Loading
Loading
+234 −234

File changed.

Preview size limit exceeded, changes collapsed.

+16 −16
Original line number Diff line number Diff line
@@ -49,36 +49,36 @@ public function testProcess(string $html, string $expected): void {
  public static function providerHtml(): array {
    return [
      'lazy loading attribute already added' => [
        'input' => '<p><img src="foo.png" loading="lazy"></p>',
        'output' => '<p><img src="foo.png" loading="lazy"></p>',
        'html' => '<p><img src="foo.png" loading="lazy"></p>',
        'expected' => '<p><img src="foo.png" loading="lazy"></p>',
      ],
      'eager loading attribute already added' => [
        'input' => '<p><img src="foo.png" loading="eager"/></p>',
        'output' => '<p><img src="foo.png" loading="eager"></p>',
        'html' => '<p><img src="foo.png" loading="eager"/></p>',
        'expected' => '<p><img src="foo.png" loading="eager"></p>',
      ],
      'image dimensions provided' => [
        'input' => '<p><img src="foo.png" width="200" height="200"/></p>',
        'output' => '<p><img src="foo.png" width="200" height="200" loading="lazy"></p>',
        'html' => '<p><img src="foo.png" width="200" height="200"/></p>',
        'expected' => '<p><img src="foo.png" width="200" height="200" loading="lazy"></p>',
      ],
      'width image dimensions provided' => [
        'input' => '<p><img src="foo.png" width="200"/></p>',
        'output' => '<p><img src="foo.png" width="200"></p>',
        'html' => '<p><img src="foo.png" width="200"/></p>',
        'expected' => '<p><img src="foo.png" width="200"></p>',
      ],
      'height image dimensions provided' => [
        'input' => '<p><img src="foo.png" height="200"/></p>',
        'output' => '<p><img src="foo.png" height="200"></p>',
        'html' => '<p><img src="foo.png" height="200"/></p>',
        'expected' => '<p><img src="foo.png" height="200"></p>',
      ],
      'invalid loading attribute' => [
        'input' => '<p><img src="foo.png" width="200" height="200" loading="foo"></p>',
        'output' => '<p><img src="foo.png" width="200" height="200" loading="lazy"></p>',
        'html' => '<p><img src="foo.png" width="200" height="200" loading="foo"></p>',
        'expected' => '<p><img src="foo.png" width="200" height="200" loading="lazy"></p>',
      ],
      'no image tag' => [
        'input' => '<p>Lorem ipsum...</p>',
        'output' => '<p>Lorem ipsum...</p>',
        'html' => '<p>Lorem ipsum...</p>',
        'expected' => '<p>Lorem ipsum...</p>',
      ],
      'no image dimensions provided' => [
        'input' => '<p><img src="foo.png"></p>',
        'output' => '<p><img src="foo.png"></p>',
        'html' => '<p><img src="foo.png"></p>',
        'expected' => '<p><img src="foo.png"></p>',
      ],
    ];
  }
+10 −10
Original line number Diff line number Diff line
@@ -512,7 +512,7 @@ public function testRollback(array $id_map_records, bool $rollback_called = TRUE
  public static function providerTestRollback() {
    return [
      'Rollback delete' => [
        'ID map records' => [
        'id_map_records' => [
          [
            'source' => '1',
            'destination' => '1',
@@ -521,17 +521,17 @@ public static function providerTestRollback() {
        ],
      ],
      'Rollback preserve' => [
        'ID map records' => [
        'id_map_records' => [
          [
            'source' => '1',
            'destination' => '1',
            'rollback_action' => MigrateIdMapInterface::ROLLBACK_PRESERVE,
          ],
        ],
        'Rollback called' => FALSE,
        'rollback_called' => FALSE,
      ],
      'Rolling back a failed row' => [
        'ID map records' => [
        'id_map_records' => [
          [
            'source' => '1',
            'destination' => NULL,
@@ -539,10 +539,10 @@ public static function providerTestRollback() {
            'rollback_action' => MigrateIdMapInterface::ROLLBACK_DELETE,
          ],
        ],
        'Rollback called' => FALSE,
        'rollback_called' => FALSE,
      ],
      'Rolling back with ID map having records with duplicated destination ID' => [
        'ID map records' => [
        'id_map_records' => [
          [
            'source_1' => '1',
            'source_2' => '1',
@@ -562,11 +562,11 @@ public static function providerTestRollback() {
            'rollback_action' => MigrateIdMapInterface::ROLLBACK_DELETE,
          ],
        ],
        'Rollback called' => TRUE,
        'Source ID keys' => ['source_1', 'source_2'],
        'rollback_called' => TRUE,
        'source_id_keys' => ['source_1', 'source_2'],
      ],
      'Rollback NULL' => [
        'ID map records' => [
        'id_map_records' => [
          [
            'source' => '1',
            'destination' => '1',
@@ -575,7 +575,7 @@ public static function providerTestRollback() {
        ],
      ],
      'Rollback missing' => [
        'ID map records' => [
        'id_map_records' => [
          [
            'source' => '1',
            'destination' => '1',
+4 −4
Original line number Diff line number Diff line
@@ -1135,7 +1135,7 @@ public function testGetHighestId(array $destination_ids, array $rows, $expected)
  public static function getHighestIdDataProvider() {
    return [
      'Destination ID type integer' => [
        'dest_ids' => [
        'destination_ids' => [
          'nid' => [
            'type' => 'integer',
          ],
@@ -1149,7 +1149,7 @@ public static function getHighestIdDataProvider() {
        'expected' => 5,
      ],
      'Destination ID types integer and string' => [
        'dest_ids' => [
        'destination_ids' => [
          'nid' => [
            'type' => 'integer',
          ],
@@ -1200,14 +1200,14 @@ public function testGetHighestIdInvalid(array $destination_ids) {
  public static function getHighestIdInvalidDataProvider() {
    return [
      'Destination ID type string' => [
        'ids' => [
        'destination_ids' => [
          'language' => [
            'type' => 'string',
          ],
        ],
      ],
      'Destination ID types int (not integer) and string' => [
        'ids' => [
        'destination_ids' => [
          'nid' => [
            'type' => 'int',
          ],
+4 −4
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ public static function getMultipleDataProvider() {
    return [
      'Single Key' => [
        'keys' => ['source_key_1'],
        'values' => ['source_value_1'],
        'expected_values' => ['source_value_1'],
      ],
      'All Source Keys' => [
        'keys' => [
@@ -389,7 +389,7 @@ public static function getMultipleDataProvider() {
          'source_key_2',
          '@@source_key_3',
        ],
        'values' => [
        'expected_values' => [
          'source_value_1',
          'source_value_2',
          'source_value_3',
@@ -401,7 +401,7 @@ public static function getMultipleDataProvider() {
          '@destination_key_2',
          '@@@destination_key_3',
        ],
        'values' => [
        'expected_values' => [
          'destination_value_1',
          'destination_value_2',
          'destination_value_3',
@@ -417,7 +417,7 @@ public static function getMultipleDataProvider() {
          'non_existent_source_key',
          '@non_existent_destination_key',
        ],
        'values' => [
        'expected_values' => [
          'source_shared_value_1',
          'destination_shared_value_1',
          'source_shared_value_2',
Loading