/** * Getter for customer group id, return default group if not set * * @return int */ public function getCustomerGroupId() { if ($this->customerGroupId === null) { return $this->groupManagement->getAllCustomersGroup()->getId(); } return parent::getCustomerGroupId(); }
/** * Getter for customer group id, return default group if not set * * @return int */ public function getCustomerGroupId() { if ($this->_customerGroupId === null) { return \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL; } return parent::getCustomerGroupId(); }
public function testGetAndSetCustomerGroupId() { $groupId = 5; $propertyGroupId = 6; $setValue = 8; $this->customerSession->expects($this->once())->method('getCustomerGroupId')->will($this->returnValue($groupId)); $property = new \ReflectionProperty($this->item, 'customerGroupId'); $property->setAccessible(true); $this->assertNull($property->getValue($this->item)); $this->assertSame($groupId, $this->item->getCustomerGroupId()); $this->assertNull($property->getValue($this->item)); $property->setValue($this->item, $propertyGroupId); $this->assertSame($propertyGroupId, $property->getValue($this->item)); $this->assertSame($propertyGroupId, $this->item->getCustomerGroupId()); $this->assertSame($this->item, $this->item->setCustomerGroupId($setValue)); $this->assertSame($setValue, $property->getValue($this->item)); $this->assertSame($setValue, $this->item->getCustomerGroupId()); }