You are here

public function MinQtyLessThanOrEqualMaxQtyConstraintValidatorTest::providerTestValidate in Commerce Product Bundle 8

Data provider for ::testValidate().

File

tests/src/Unit/Plugin/Validation/Constraint/MinQtyLessThanOrEqualMaxQtyConstraintValidatorTest.php, line 72

Class

MinQtyLessThanOrEqualMaxQtyConstraintValidatorTest
Test the MinQtyLessThanOrEqualMaxQty constraint validator.

Namespace

Drupal\Tests\commerce_product_bundle\Unit\Plugin\Validation\Constraint

Code

public function providerTestValidate() {
  $constraint = new MinQtyLessThanOrEqualMaxQtyConstraint();
  $bundleItemMock = $this
    ->prophesize(BundleItemInterface::class);
  $bundleItemMock
    ->getMinimumQuantity()
    ->willReturn(1, 0, 1, 20);
  $bundleItemMock
    ->getMaximumQuantity()
    ->willReturn(1, 1, 10, 10);
  $entity = $bundleItemMock
    ->reveal();

  // Case 1: Default values, Min = Max.
  $cases[] = [
    $entity,
    FALSE,
  ];

  // Case 2: Min < Max, Min = 0.
  $cases[] = [
    $entity,
    FALSE,
  ];

  // Case 3: Min < Max, Min > 0.
  $cases[] = [
    $entity,
    FALSE,
  ];

  // Case 4: Min > Max.
  $cases[] = [
    $entity,
    $constraint->message,
  ];
  return $cases;
}