Commit bb59520c authored by Vasyl Kydyba's avatar Vasyl Kydyba
Browse files

Issue #3015199: add tests for new message option

parent 66c10109
Loading
Loading
Loading
Loading
+34 −0
Changes for tests/src/Unit/process/SkipOnValueTest.php: 34 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -27,6 +27,23 @@ class SkipOnValueTest extends MigrateProcessTestCase {
      ->transform('86', $this->migrateExecutable, $this->row, 'destinationproperty');
  }

  /**
   * Tests that a skip process exception with a message is raised.
   *
   * @covers ::process
   */
  public function testProcessSkipWithMessage() {
    $configuration = [
      'method' => 'process',
      'value' => 86,
      'message' => 'The value is 86',
    ];
    $process = new SkipOnValue($configuration, 'skip_on_value', []);
    $this->expectException(MigrateSkipProcessException::class);
    $this->expectExceptionMessage('The value is 86');
    $process->transform(86, $this->migrateExecutable, $this->row, 'destination_property');
  }

  /**
   * @covers ::process
   */
@@ -106,6 +123,23 @@ class SkipOnValueTest extends MigrateProcessTestCase {
      ->transform('86', $this->migrateExecutable, $this->row, 'destinationproperty');
  }

  /**
   * Tests that a skip row exception with a message is raised.
   *
   * @covers ::row
   */
  public function testRowSkipWithMessage() {
    $configuration = [
      'method' => 'row',
      'value' => 86,
      'message' => 'The value is 86',
    ];
    $process = new SkipOnValue($configuration, 'skip_on_value', []);
    $this->expectException(MigrateSkipRowException::class);
    $this->expectExceptionMessage('The value is 86');
    $process->transform(86, $this->migrateExecutable, $this->row, 'destination_property');
  }

  /**
   * @covers ::row
   */