new LineItemQuantity('ABC', 2
),
new LineItemQuantity('DEF', 3
),
] ));
$package2 =
new DiscountPackage(new LineItemQuantityCollection( [ new LineItemQuantity('GHJ', 1
),
] ));
$splitted =
(new DiscountPackageCollection([$package1,
$package2]))->
splitPackages();
static::
assertEquals(3,
$splitted->
count());
$package1 =
$splitted->
getElements()[0
];
$package2 =
$splitted->
getElements()[1
];
$package3 =
$splitted->
getElements()[2
];
// now test the content of each package. only 1 item has to be in there
static::
assertEquals(1,
$package1->
getMetaData()->
count());
static::
assertEquals(1,
$package2->
getMetaData()->
count());
static::
assertEquals(1,
$package3->
getMetaData()->
count());
}