15 private $minSaleQtyConfig;
20 $this->minSaleQtyConfig =
$objectManager->create(Minsaleqty::class);
21 $this->minSaleQtyConfig->setPath(
'cataloginventory/item_options/min_sale_qty');
37 $this->minSaleQtyConfig->setValue(
$value);
38 $this->minSaleQtyConfig->save();
39 $this->assertEquals($encodedExpectedValue, $this->minSaleQtyConfig->getValue());
41 $this->minSaleQtyConfig->load($this->minSaleQtyConfig->getId());
42 $hashedConfig = $this->minSaleQtyConfig->getValue();
44 if (!is_array($hashedConfig)) {
45 $this->fail(
'Loaded value is not an array, skipping further validation');
48 $indexedConfig = array_values($hashedConfig);
49 $this->assertEquals($decodedExpectedValue, $indexedConfig);
58 $groupManagement =
$objectManager->create(GroupManagementInterface::class);
59 $allCustomersGroupID = $groupManagement->getAllCustomersGroup()->getId();
60 $notLoggedInGroupID = $groupManagement->getNotLoggedInGroup()->getId();
63 'bool' => [
false,
'', []],
64 'empty string' => [
'',
'', []],
65 'empty array' => [[],
'[]', []],
66 'valid numeric - all customer group' => [
71 'customer_group_id' => $allCustomersGroupID,
76 'invalid named group array' => [
77 [
'customer_group_id' => 1,
'min_sale_qty' => 2.5],
78 '{"customer_group_id":1,"min_sale_qty":2.5}',
81 'customer_group_id' =>
'customer_group_id',
85 'customer_group_id' =>
'min_sale_qty',
90 'valid array - all customer group' => [
91 [[
'customer_group_id' => $allCustomersGroupID,
'min_sale_qty' => 2.5]],
95 'customer_group_id' => $allCustomersGroupID,
100 'valid named group' => [
101 [[
'customer_group_id' => 2,
'min_sale_qty' => 2.5]],
105 'customer_group_id' => 2,
106 'min_sale_qty' => 2.5
110 'invalid - cannot override not logged in group' => [
111 [$notLoggedInGroupID => [
'min_sale_qty' => 2.5]],
115 'customer_group_id' => $notLoggedInGroupID,
saveAndLoadDataProvider()
testSaveAndLoad($value, $encodedExpectedValue, array $decodedExpectedValue)
static getObjectManager()